URI - BEECROWD - BEE 1060 - Positive Numbers Solution in C,C++,Python | URI - BEECROWD - BEE Solution 1060

URI - BEECROWD - BEE 1060 - Positive Numbers Solution in C,C++,Python | URI - BEECROWD - BEE Online Judge Solution 1060 - Positive Numbers

Write a program that reads 6 numbers. These numbers will only be positive or negative (disregard null values). Print the total number of positive numbers.

Input

Six numbers, positive and/or negative.

Output

Print a message with the total number of positive numbers.

Input SampleOutput Sample

7
-5
6
-3.4
4.6
12

4 valores positivos

URI 1060 - Positive Numbers Solution in C,C++,Python | URI Online Judge Solution 1060 - Positive Numbers :

                                        Demonstration:

If any number that represents more than zero of anything then it is called as positive number. For example,15 is a positive number because it's greater than zero.  Zero is called the origin, and it's neither negative nor positive.
First we need to taking all of the inputs by using for loop.We will run for loop until 6 and increment the count/sum if the given numbers are greater than zero.
N.B: Don't copy paste the code as same. Just try to understand it and try yourself. It would be better for you.


  URI Problem 1060 Solution in C :   

  URI Online Judge 1060 Solve  in C :                                                                             
#include<stdio.h>
 
int main()
{
    float x;
    int i,sum=0;
    for(i=1;i<=6;i++){
        scanf("%f",&x);
        if(x>0){
        sum=sum+1;
        }
    }
    printf("%d valores positivos\n",sum);
    return 0;//end line
}

0 Response to URI - BEECROWD - BEE 1060 - Positive Numbers Solution in C,C++,Python | URI - BEECROWD - BEE Solution 1060

Post a Comment