C-programming - Find the number of odd and even numbers, C program to find number of odd and even numbers
Find the number of odd and even numbers
This program calculates the number of odd and even numbers. Here for loop is used for iterative purpose and if statement to check the condition.
#include<stdio.h>
#include<conio.h>
int main()
{
int i,a,odd=0,even=0;
for(i=0; i<=5; i++)
{
scanf("%d",&a);
if ((a%2)==1)
odd+=1;
else
even+=1;
}
printf("odd numbers %d and even numbers %d",odd,even);
getch();
}
output
odd numbers 3 and even numbers 2
The topic on C-programming - Find the number of odd and even numbers is posted by - Math
Hope you have enjoyed, C-programming - Find the number of odd and even numbersThanks for your time