Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Monday 14 November 2016

URI-1060

URI Online Judge | 1060

Positive Numbers

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
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

Solution...

#include<stdio.h>
int main()
{
    int count=0,n=0;
    float a;
    while(n!=6){
        scanf("%f",&a);
        if(a>=0){
            count++;
        }
        n++;
    }
    printf("%d valores positivos\n",count);
    return 0;
}

No comments:

Post a Comment