URI - BEECROWD - BEE 1066 - Even,Odd,Positive and Negative Solution in C,C++,Python | URI - BEECROWD - BEE Online Judge Solution 1066 - Even,Odd,Positive and Negative
Make a program that reads five integer values. Count how many of these values are even, odd, positive and negative. Print these information like following example.
Input
The input will be 5 integer values.
Output
Print a message like the following example with all letters in lowercase, indicating how many of these values are even, odd, positive and negative.
Input Sample | Output Sample |
-5 | 3 valor(es) par(es) |
URI - BEECROWD - BEE 1066 - Even,Odd,Positive and Negative Solution in C,C++,Python | URI - BEECROWD - BEE Online Judge Solution 1066 - Even,Odd,Positive and Negative:
Demonstration:
URI - BEECROWD - BEE Problem 1066 Solution in C :
URI - BEECROWD - BEE Online Judge 1066 Solve in C : |
#include <stdio.h>
int main() {
int i,num,even=0,odd=0,positive=0,negative=0;
for(i=1;i<=5;i++){
scanf("%d",&num);
if(num%2==0){
even++;
}
if(num%2!=0){
odd++;
}
if(0<num){
positive++;
}
if(0>num){
negative++;
}
}
printf("%d valor(es) par(es)\n",even);
printf("%d valor(es) impar(es)\n",odd);
printf("%d valor(es) positivo(s)\n",positive);
printf("%d valor(es) negativo(s)\n",negative);
return 0;
}
0 Response to URI - BEECROWD - BEE 1066 - Even,Odd,Positive and Negative Solution in C,C++,Python
Post a Comment