0

Write a program to find the sum of natural numbers from 1 to 10.

BU JAVA SCANNER CLASS

3rd Sep 2021, 9:05 AM
Asmit Choudhary
Asmit Choudhary - avatar
1 Answer
+ 1
int sum = 0; for(int x=1; x<=10; x++) sum += x; System.out.println(sum); I don't understand where Scanner (input) is needed in your question. :|
3rd Sep 2021, 9:13 AM
Rupali Haldiya
Rupali Haldiya - avatar