To check whether the given number is even or odd by using special Operators

 Program:

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

Output:

Enter any Number : 2
Given Number is Even


No comments:

Post a Comment