URI Problem 1064 – “Positives and Average” solution( Bangla ) | C language

**Before watching this make sure that you’ve tried enough**

#include <stdio.h>

int main()
{
    float temp = 0, avg;
    float arr[5];
    int i, n,a = 0;
    n = 0;
    for(i = 0;i < 6;i++){
        scanf("%f", &arr[i]);
    }
    for(i = 0;i < 6;i++){
        if (arr[i] > 0){
            n = n + 1;
            temp = temp + arr[i];
        }
        else a = a + 1;
    }
    avg = temp / n;
    printf("%d valores positivos\n", n);
    printf("%.1f\n", avg);

    return 0;
}

 

 

If this solution helped you, please share this with your friends.
And if you have anything to say, let me know in the comment section.
More solutions are coming so Like our Facebook page and Subscribe to our YouTube channel to stay connected.

Leave a Comment