I have a problem which I am trying to solve. The work is like:

The user will input a number say 5 and the output will be

```
Output:
5 55 555 5555 55555
sum: 61725

```

Another example,

```
Input: 4
Output: 
4 44 444 4444
sum: 4936

```

I have displayed the series but can't do the sum.

```
Scanner input = new Scanner(System.in);

    System.out.print("Input: ");
    int in = input.nextInt();
    int sum = 0;

    System.out.println("Output: ");

    for(int i=1;i<=in;i++){
        for(int j=0;j<i;j++){
            System.out.print(in);
        }
        System.out.print(" ");  
    }

```

this will print the series. You can change the whole code, no problem. Just CAN'T use any builtin function like `Math.pow()` etc.

I was thinking of using : 

```
for(int a=1;a<=in;a++){ 
    f=f*10+in; sum+=f; 
}

```