//WAP to input 30 number in array & count how many are even and how many are odd. #include<stdio.h> #include<conio.h> void main() { int i,num[30],ec=0,oc=0; clrscr(); printf("Enter value in array:\n"); for(i=0;i<30;i++) scanf("%d",&num[i]); for(i=0;i<30;i++) { if(num[i]%2==0) ec++; else oc++; } printf("No of even = %d",ec); printf("No of odd = %d",oc); getch(); }
Comments
Post a Comment