write a program in Java to print first 10 natural numbers using 'for' loop with their sum with correct syntax.
Answers
Answered by
22
Answer:
The first 10 natural nos are:
1
2
3
4
5
6
7
8
9
10
Explanation:
public class Exercise10 {
public static void main(String[] args)
{
int i;
System.out.println ("The first 10 natural numbers are:\n");
for (i=1;i<=10;i++)
{
System.out.println (i);
}
System.out.println ("\n");
}
}
Answered by
9
Answer:
class num
{
public static void main(String args[])
{
int n ;
for(n=1;n<=20;n+=2)
{
System.out.println(n);
}
}
}
Hope this helps you....
Pls mark me brainliest.....
Similar questions
Psychology,
6 months ago
Math,
6 months ago
Chemistry,
1 year ago
Science,
1 year ago
Math,
1 year ago