Friday, 4 December 2015

ODD OR EVEN NUMBER

AIM
To write a C program to check the given number is odd or even.
ALGORITHM
Step 1: Start
Step 2: Read a
Step 3: if (a%2=0), if not go to step 5
Step 4: Print Given number is even
Step 5: Print Given number is odd
Step 6: Stop
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
            printf(“Enter a number:”);
            scanf(“%d”,&a);
            if (a%2==0)
                        printf(“\nGiven number is even.”);
            else
                        printf(“\nGiven number is odd.”);
            getch();
}


No comments:

Post a Comment