condition for (upto ten) in java language
like x<6
please help
Answers
Answer:
x<=10 is the condition when you want to check for( upto10)
Condition for (upto ten) in java language
Explanation:
Write a Java program to print the first 10 natural numbers using conditional for loop statement
public class Main {
public static void main(String[] args)
{
int i;
System.out.println ("The first 10 natural numbers are:\n");
for (i=1;i<=10;i++) // i<=10 is condition
{
System.out.println(i);
}
System.out.println ("\n");
}
}
Output of above program:
The first 10 natural numbers are:
1
2
3
4
5
6
7
8
9
10