Computer Science, asked by devil3154, 10 months ago

WAP to print the following
series program in Java 1+10+100+1000.....n terms



plzzzz someone help me out with this programme Plz help me .....​

Answers

Answered by anunknownuser
1

Answer:

If n=2, sum=11

Explanation:

import java.util.*;

public class series {

public static void main() {

int startingno=1, n, sum;

System.out.println("Enter your choice");

Scanner sc=new Scanner(System.in);

n=sc.nextInt();

for (int i=1;i<=n;i++) {

sum=sum+startingno;

startingno*=10;

}

System.out.println(sum);

}

}

Similar questions