/*wap to find number of odd, even & zero numbers from given 10 int numbers*/ #include<stdio.h> #include<conio.h> void main() { int n[10],i,count1=0,count2=0,count3=0; clrscr(); printf("enter any 10 int numbers:\n"); for(i=0;i<10;i++) { scanf("%d",&n[i]); } for(i=0;i<10;i++) { if(n[i]==0) count1++; else if(n[i]%2==0) count2++; else if(n[i]%2!=0) count3++; } printf("odd numbers:%d",count3); printf("\neven numbers:%d",count2); printf("\nzero numbers:%d",count1); getch(); }
No comments:
Post a Comment