Answer to Question #286230 in C for Sh sd

Question #286230

Reading 10 integers between 0-100 and counts how many of the are larger than 50 and displaying the result

1
Expert's answer
2022-01-10T07:38:22-0500
#include <stdio.h>

int main() {
    int count=0, x, n=0;

    while (n<100) {
        scanf("%d", &x);
        if (x>=0 && x<=100) {
            n++;
            if (x > 50) {
                count++;
            }
        }
    }
    
    printf("There were %d numbers greater than 50\n", count);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS