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,
9 months ago
Math,
1 year ago
Science,
1 year ago