Computer Science, asked by DrStudy, 1 year ago

write a program in Java to print first 10 natural numbers using 'for' loop with their sum with correct syntax.​

Answers

Answered by abhijitgamerz
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 ayanaslam2005
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