[URI Online Judge] – 1065 – Even Between five Numbers

Make a program that reads five integer values. Count how many of these values ​​are even and  print this 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 even numbers were typed.

Sample Input Sample Output
7
-5
6
-4
12
3 valores pares

Solution:

#include <cstdio>

int main(){
int n, c = 0, i = 5;
while(i–){
scanf(“%d”, &n);
if (n % 2 == 0)
c++;
}
printf(“%d valores pares\n”, c);

return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s