URI 1065 - Even Between Five Numbers Solution in C,C++,Python | URI Online Judge Solution 1065 - Even Between Five Numbers

URI 1065 - Even Between Five Numbers Solution in C,C++,Python | URI Online Judge Solution 1065 - Even Between Five Numbers

Make a program that reads five integer valuesCount how many of these values ​​are even and  print this information like the 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.

Input SampleOutput Sample

7
-5
6
-4
12

3 valores pares

URI 1065 - Even Between Five Numbers Solution in C,C++,Python | URI Online Judge Solution 1065 - Even Between Five Numbers:

                                        Demonstration:

Even numbers are those numbers that can be divided into two equal groups or pairs and are exactly divisible by 2.
Here we apply a range-based for loop which provides all the integers available in the input interval.
After this, a check condition for even numbers is applied to filter all the odd numbers and increment the count variable. 
Finally, print the result.
N.B: Don't copy paste the code as same. Just try to understand it and try yourself.


  URI Problem 1065 Solution in C :   

  URI Online Judge 1065 Solve  in C :                                                                             
#include <stdio.h>
 
int main()
{
    int i,num,count=0;
    for(i=1;i<=5;i++){
        scanf("%d",&num);
        if(num%2==0){
          count++;
        }
    }
    printf("%d valores pares\n",count);
    return 0;
}

0 Response to URI 1065 - Even Between Five Numbers Solution in C,C++,Python | URI Online Judge Solution 1065 - Even Between Five Numbers

Post a Comment