Advertisement
PROFESSOR_AIH

Even, Odd, Positive and Negative

Mar 29th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int even=0,odd=0,pos=0,neg=0,num,i;
  5.     for(i=1; i<=5; i++)
  6.     {
  7.         scanf("%d",&num);
  8.         if(num%2==0)
  9.         {
  10.             even++;
  11.         }
  12.         if(num%2!=0)
  13.         {
  14.             odd++;
  15.         }
  16.         if(num>0)
  17.         {
  18.             pos++;
  19.         }
  20.         if(num<0)
  21.         {
  22.             neg++;
  23.         }
  24.         num=0;
  25.     }
  26.     printf("%d valor(es) par(es)\n",even);
  27.     printf("%d valor(es) impar(es)\n",odd);
  28.     printf("%d valor(es) positivo(s)\n",pos);
  29.     printf("%d valor(es) negativo(s)\n",neg);
  30.  
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement