Get Update on recent Technology & Programming

Wednesday, 15 November 2017

C Program to print whether a number is even or odd

Posted by   on Pinterest

C 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;

}



No comments:
Write comments

Hey, we've just launched a new custom color Blogger template. You'll like it -
Join Our Newsletter