
write program s=1+12+123+1234+.........+123....n terms

import java.util.*;
class NumberExample
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter value of n: ");
int n=input.nextInt();
int sum=0;
int m=0;
for(int i=1; i<=n; i++){
for(int j=1; j<=i; j++){
System.out.print(j);
sum+=j;
}
System.out.print(" ");
}
System.out.println();
System.out.println("Sum of series: "+sum);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.