To find out Even and odd number in c Programming.


To find out Even and odd number in c Programming.

Theory :  First we have to take a veriable name num .Now we take a input from user .Then we have to appy this theory (
if(num%2==0)
        printf("It is a Even number ");
    else
        printf("It is odd");
)


Source Code :
                          
#include<stdio.h>
int main()
{
    int num;
    printf("Enter the value of num:");
    scanf("%d",&num);

    if(num%2==0)
        printf("It is a Even number ");
    else
        printf("It is odd");
    return 0;
}


Output :

Enter the value of num:25
It is odd


No comments

Powered by Blogger.