To check whether the given number is even or odd by using if-else

 Program:


#include<stdio.h>
#include<conio.h>
void main()
{
    int n;
    clrscr();
    printf("Enter any Number : ");
    scanf("%d", &n);
    if(n%2==0)
        printf("Given Number is Even");
    else
        printf("Given Number is Odd");
    getch();
}

Output:


Enter any Number : 26
Given  Number is Even



Next Topic        :  

Previous Topic :

No comments:

Post a Comment