Computer Science, asked by sumitsabarwal, 8 hours ago

write a program to generate all natural numbers from 1 to 10 using while loop

Answers

Answered by aroraganishka
0

Answer:

ok I will write and generate it also

Answered by sweetboy43
1

Answer:

public class KboatNaturalNumbers

{

public static void main(String args[]) {

int n = 1;

int sum = 0;

while (n <= 10) {

System.out.println(n);

sum = sum + n;

n = n + 1;

}

System.out.println("Sum = " + sum);

}

Explanation:

hope it is helpful please follow add brain list

Similar questions