Computer Science, asked by user1345, 1 year ago

write a program to print first 15 natural numbers...


amannishad0512p5zxh6: First of all tell me, in which programming language
amannishad0512p5zxh6: Java,python ,c++,c or any other language
amannishad0512p5zxh6: You want program !!

Answers

Answered by sahilghadi1111110
2
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}


hope this will help you
Answered by stylishtamilachee
10

Answer:

public class Test

{

void prnNaturalNos( )

{

int i = 1 ;

for (i= 1 ; i < = 15 ; i++)

System.out.print( i ) ;

}

}

Output Produced is:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The For loop:

The for loop is the easiest to understand of the Java loops.

All its loop-control elements are gathered in one place (on the top of the loop) , while in the other loop construction of Java, they (top-control elements) are scattered about the program.

Similar questions