Geography, asked by ganasirisk, 8 months ago

write a java program to find the sum of any ten natural numbers. please solve this question ​

Answers

Answered by kmarianit
4

Answer:

Java Program to Find Sum of Natural Numbers Using While Loop

public class Natural.

int x, i = 1 ;

int sum = 0;

System. out. println("Enter Number of items :");

Scanner s = new Scanner(System.

x = s. nextInt();

while(i <= x)

sum = sum +i;

Explanation:

HOPE THIS ANSWER WILL HELP YOU

Similar questions