Answer to Question #284980 in C for mahindra

Question #284980

Read 10 integers from the keyboard in the range 0 -100, and count how many of them are larger than 50, and display this result.


1
Expert's answer
2022-01-05T08:13:34-0500
#include <stdio.h>

int main()
{
    
    int arr[10] = {};
    int quantity_more50 = 0;
    for (int i = 0; i != 10; ++i)
    {
        printf( "Enter a value, range 0 - 100: ");
        scanf("%d", &arr[i]);
    }
    
    for(int i = 0; i!= 10; ++i)
    {
        if(arr[i] > 50)
        {
            printf("%d\t", arr[i]);
            quantity_more50 += 1;
        }

    }
    printf("\nThe quantity is %d \n", quantity_more50);
    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