Computer Science, asked by rrajinder812, 1 year ago

java program to display first ten natural numbers using while loop​

Answers

Answered by RewelDeepak
1

Answer:

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;

Similar questions