Computer Science, asked by DeeptiKaloya, 4 months ago

Q5. Write a program to print the even
numbers from 1 to 100​

Answers

Answered by abhinavpandey2
4

Answer:

Using Java for Loop

  • public class DisplayEvenNumbersExample1.
  • {
  • public static void main(String args[])
  • {
  • int number=100;
  • System.out.print("List of even numbers from 1 to "+number+": ");
  • for (int i=1; i<=number; i++)
  • {
Answered by Yamini2110
1

#include<studio.h>

void main()

{

int i;

clrscr();

for(i = 1; i < =100; i ++)

{

if(i % 2 ==0)

{

printf("%d \n",i);

}

}

getch();

}

Similar questions