Q:

Write a program in c to find even or odd numbers

0

Write a program in c to find even or odd numbers

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Flowchart:

Algorithm:-

·        start

·        input number

·        if(number%2==0) then it is even number

·        else odd number

·        end

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int n,r;
clrscr();
printf(“Enter a number:”);
scanf(“%d”,&n);
r=n%2;
if(r==0)
{
printf(“Even number”);
}
else
{
printf(“odd number”);
}
getch();
}

Output:

Enter a number :4
Even number
Enter a number :5
odd number

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Programming Exercises With Solutions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a program in c to print fabonnaci series... >>
<< Write a program in c to calculate power using recu...