"C" Programs for Biginners



// Write a ‘C’ program to input a Number and check it is EVEN or ODD using if( )---else statement?                                          EVENODD1.C

# include <stdio.h>
# include <conio.h>
void main( )
{
          int  N;
          clrscr( );
          printf(“Input a Number  = ”);
          scanf(“%d”, &N);
          if(N%2==0)
          {
                   printf(“This is an EVEN Number”);
          }
          else
          {
                   printf(“This is an ODD Number”);
          }
          Printf(“\n Good Day”);
}

OUTPUT-1:
Input a Number = 8
This is an Even Number
Good Day

OUTPUT-2:
Input a Number = 5
Good Day

No comments:

Post a Comment