Write a C program to find whether a given number is odd or even

#include<stdio.h>
main()
{
int a,b;

printf("enter a number to check if the number is odd or even");
scanf("%d",&a);
b=(a%2);
if (b=0)
printf("your inputed number %d is even",a);
else
printf("your inputed number %d is odd",a);
return 0;
}

Comments

  1. C program to check odd or even

    In general Even numbers are those which are divisible by 2, and which numbers are not divisible 2 is called odd numbers.
    We can easily write even odd program in c programming.

    ReplyDelete

Post a Comment