google407ec42f1ae5ff0e.html Program to print whether a number is even or odd
top of page

Program to print whether a number is even or odd

P5.2 Program to print whether a number is even or odd

#include<stdio.h>

int main(void)

{

int num;

printf("Enter a number : ");

scanf("%d",&num);

if(num%2 == 0) /*test for even */

printf("Number is even\n");

else

{

printf("Number is odd\n");

num*=2;

printf("Now the number is %d\n",num);

}

return 0;

}

4 views0 comments

Recent Posts

See All
bottom of page