Wednesday, June 15, 2016

SOLUTION OF URI 1064


//  1064   (Mahmud_Jamil) BRUR
//    question of  1064 Positives and Average



#include<stdio.h>
int main()
{
    int i,count=0;
    float n,sum=0.0,average;
    for(i=1;i<=6;i++){
        scanf("%f",&n);
        if(n>0){
            sum+=n;
            count++;
        }
        average=sum/(float)count;
    }
    printf("%d valores positivos\n",count);
    printf("%.1lf\n",average);
    return 0;
}



0 comments:

Post a Comment