Advertisement
mustahidhasan

Untitled

Jun 22nd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include<stdio.h>///hw number 3;
  2.  
  3. int main(){
  4.  
  5.     int n, i, e = 0, o = 0;
  6.     printf("How many Numbers You want to insert..?\n");
  7.     scanf("%d", &n);
  8.     int a[n+1];
  9.     printf("Enter %d array elements\n", n);
  10.  
  11.     for(i = 0; i < n; i++){
  12.         scanf("%d", &a[i]);
  13.     }
  14.  
  15.     for(i = 0; i < n; i++){
  16.         if(a[i] % 2 == 0)
  17.             e++;
  18.         else
  19.             o++;
  20.     }
  21.  
  22.     printf("Total even numbers = %d\n", e);
  23.     printf("Total odd numbers = %d\n", o);
  24.  
  25.  
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement