Computer Science, asked by harshalkasundra536, 1 year ago

Write a program to explain “for loop”

Answers

Answered by batoolfatimakhan
1

class Even Numbers

{

   public void check(int x)

   {

       for(int i=1; i<=x; i++)

       {

           if(i%2==0)

           System.out.println("It is an even number");

else

System.out.println("It is an odd number");

       }}}


batoolfatimakhan: This was to check if all the numbers within a given range as even or not...if you want the explanation of the program..then say..i'll give another answer
Answered by emondal83
1

class natural numbers

{

static void main ()

{

int a;

System.out.println("the natural numbers are :");

for(a=1;a<=10;a++)

System.out.print(a+" ");

}

}

Similar questions