Wednesday, December 2, 2015

Uri problem 1065 solve

Problem :

Even Between five Numbers

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Make a program that reads five integer valuesCount 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 InputSample Output
7
-5
6
-4
12
3 valores pares

Solution:

#include<stdio.h>
 
int main()
{
    int i , j, inp[5], sum;
    for(i = 0; i < 5; i++)
        scanf("%d",&inp[i]);
        sum = 0;
        for(j = 0; j < 5; j++){
            if(inp[j] % 2 == 0)
                sum=sum + 1;
                 else
                  sum=sum;
        }
                printf("%d valores pares\n",sum);
 
 
    return 0;
}

No comments:

Post a Comment