Saturday, September 15, 2012

code #10:C Program to Check odd or even using conditional operator

| |

#include<stdio.h>

main()
{
   int n;

   printf("Enter an integer\n");
   scanf("%d",&n);

   n%2 == 0 ? printf("Even number\n") : printf("Odd number\n");

   return 0;
}

0 comments:

Post a Comment

Powered by Blogger.