write a java program to find the sum of any ten natural numbers. please solve this question
Answers
Answered by
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
Social Sciences,
4 months ago
English,
4 months ago
Biology,
8 months ago
Math,
11 months ago
Science,
11 months ago
Business Studies,
11 months ago