Monday, February 15, 2016

C Program to check Even or Odd

/*=================================================================================
 **
 **  File Name     : evenodd.c
 **  Creation Date : Tue 16 Feb 2016 12:55:54 AM IST
 **  Last Modified : Tue 16 Feb 2016 01:02:17 AM IST
 **  Compoler      : gcc
 **  Author        : Manoj Kumar Patra, manojpatra.sit@gmail.com
 **  Organization  : SCIS, University of Hyderabad, India.
 **
 **===============================================================================*/

#include <stdio.h>
int main()
{
    printf("\n= = = = = Program to check Even or Odd = = = = = = =\n");
    int n;
    printf("\nEnter an integer : ");
    scanf("%d", &n);
    if(n%2 == 0)
    {
        printf("\nThe entered number %d is a Even number.\n",n);
    }
    else
    {
        printf("\nThe entered number %d is a Odd number.\n",n);
    }
    printf("\n= = = = = = = = = = = = = = = = = = = = = = = = = = =\n\n");
    return 0;
}

OutPut :

max@ubuntu:~/cprog$ gcc evenodd.c -o evenodd
max@ubuntu:~/cprog$ ./evenodd

= = = = = Program to check Even or Odd = = = = = = =

Enter an integer : 23

The entered number 23 is a Odd number.

= = = = = = = = = = = = = = = = = = = = = = = = = = =

max@ubuntu:~/cprog$ ./evenodd

= = = = = Program to check Even or Odd = = = = = = =

Enter an integer : 46000

The entered number 46000 is a Even number.

= = = = = = = = = = = = = = = = = = = = = = = = = = =

No comments:

Post a Comment