Computer Science, asked by AnishaRoshan, 4 months ago

Write a do- while( ) loop to print the natural numbers from 1 to 15.​

Answers

Answered by Sparky16118208
2

Answer:

int i = 1;

do

{

System.out.println(i);

i += 1;

}while(i<=15);

Explanation:

variable i is stored with the natural number to be printed.

When it comes inside the it gets printed and then gets incremented. Then the condition is checked. If the condition evaluates to true then the loop continues else it is terminated.

(I use the BlueJ environment)

Mark it as the brainliest , if you find it helpful.

Similar questions