How to print 10 natural numbers

//How to print 10 natural numbers

class M
{
public static void main(String args[])
{
System.out.println("Natural number is: ");
for(int i=1;i<=10;i++)
{
System.out.println(""+i);
}
}
}


OUTPUT:
Natural number is:
1
2
3
4
5
6
7
8
9
10

No comments:

Post a Comment