Header Ads

Even numbers between 1 to 100

C program for printing even numbers between 1 to 100

Even number : number that when divided by 2 yields reminder as 0 is known as even number.
Example: 4 % 2 = 0, 5 % 2 = 1
so, 4 is even and 5 is odd

#include<stdio.h>
#include<conio.h>
main()
{
    int i;
    printf("Even : ");
    for(i=1;i<=100;i++)
    {
        if(i%2==0)
            printf("%d ",i);
    }
    getch();

}

Output:


screenshot of output for even number between 1 to 100
Related programs:

No comments