Question: calculate the value of S = a + AA + AAA + AAAA + AA... A, where A is a number.
For example, 2 + 22 + 222 + 2222 + 22222 (a total of 5 numbers are added at this time), and the addition of several numbers is controlled by the keyboard.
Package WZS. arithmetics; import Java. io. bufferedreader; import Java. io. ioexception; import Java. io. inputstreamreader; // question: S = a + AA + AAA + AAAA + AA... the value of A, where A is a number. // For example, 2 + 22 + 222 + 2222 + 22222 (a total of 5 numbers are added at this time), and the addition of several numbers is controlled by the keyboard. Public class test_wzs8 {public static void main (string [] ARGs) throws ioexception {bufferedreader BR = new bufferedreader (New inputstreamreader (system. in); string _ temp = BR. readline (); int temp = integer. valueof (_ temp); int newnumber = 0; // new number generated each time int Total = 0; // calculation result for (INT I = 0; I <temp; I ++) {newnumber = newnumber * 10 + temp; system. out. println (newnumber); Total = total + newnumber;} system. out. println ("Calculation Result:" + total );}}