PROGRAM TO FIND OUT GIVEN NUMBER IS EVEN OR ODD

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

PROGRAM TO FIND OUT GIVEN NUMBER IS EVEN OR ODD

Postby rohit.wadhwa » Wed Mar 18, 2009 5:18 pm

Code: Select all
   /* PROGRAM TO FIND OUT GIVEN NUMBER IS EVEN OR ODD*/
    /* author-Rohit Wadhwa*/
    #include<stdio.h>
    #include<conio.h>
    void  main()
    {
    int n;
    int val;
    printf("Enter a number Check for Even or Odd:\n");
    scanf("%d",&n);
    if(n%2==0)
    printf("%d is a even number",n);
   else
   printf("%d is a odd number",n);
    getch();
    }
Thanks
Rohit Wadhwa
Site : Study Site
User avatar
rohit.wadhwa
Moderator
 
Posts: 53
Joined: Mon Mar 16, 2009 4:00 pm
Location: Hisar(Haryana)
membership: Senior Technician of The Institution of Engineers (India)- ST

Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests