write a program to display all natural numbers from 1 to 10
Answers
Answered by
2
To show the natural number count the table of 2
Answered by
2
Here's the Java program for your question :
public class natural_nos_1_10
{
public static void main ( )
{
int sum=0;
for ( int x=1;x<=10;x++)
{
sum=sum+x;
}
System.out.println ( "Total sum ="+sum);
}
}
public class natural_nos_1_10
{
public static void main ( )
{
int sum=0;
for ( int x=1;x<=10;x++)
{
sum=sum+x;
}
System.out.println ( "Total sum ="+sum);
}
}
Similar questions