First part:
Algorithm to know a number is even or odd
step 1:read/input a number 'x'
step 2:Let y= remainder obtained after dividing x by 2
step 3:If y=0 then
display it is an even
else
display it is an odd
step 4:stop
second part:-
Flowchart:-
//'C' program to know a number is even or odd
#include<stdio.h>
#include<conio.h>
void main()
{
int x;
printf("enter a number\n");
scanf("%d",&x);
if(x%2==0)
{
printf("it is an even number");
}
else
{
printf("it is an odd number\n");
}
getch();
}
Algorithm to know a number is even or odd
step 1:read/input a number 'x'
step 2:Let y= remainder obtained after dividing x by 2
step 3:If y=0 then
display it is an even
else
display it is an odd
step 4:stop
second part:-
Flowchart:-
//'C' program to know a number is even or odd
#include<stdio.h>
#include<conio.h>
void main()
{
int x;
printf("enter a number\n");
scanf("%d",&x);
if(x%2==0)
{
printf("it is an even number");
}
else
{
printf("it is an odd number\n");
}
getch();
}
No comments:
Post a Comment