C Program


Write a program to check last digit of given number is even or odd.


#include<stdio.h>
void main()
{
    int number;
    int mod;
    printf("Enter value : ");
    scanf("%d",&number);
   
    mod = number % 10;
   
    if(mod%2 == 0)
    {
        printf("%d is even", mod);
    }
    else
    {
        printf("%d is odd", mod);
    }   
}

Output :




Post a Comment

0 Comments