Thursday 3 October 2013

Finding a number is odd/even using C

#include<stdio.h>
main()
{
int num;
printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
printf("Enter the number: ");
scanf("%d",&num);
if(num%2==0)
printf("number(%d) entered is an even number\n",num);
else
printf("number(%d) entered is an odd number\n",num);
}

No comments:

Post a Comment