Apr 17, 2013

C program to count odd numbers from entered numbers


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,no,n,o=0;
clrscr();
printf("how many nos.you want to enter =");
scanf("%d",&no);
for(i=1;i<=no;i++)
{
printf("no[%d]=",i);
scanf("%d",&n);
if(n%2!=0)
{
o++;
}
}
printf("odd=%d",o);
getch();
}


OUTPUT


how many nos.you want to enter =5
no[1]=1
no[2]=2
no[3]=5
no[4]=6
no[5]=7
odd=3


0 comments:

Post a Comment