URI Online Judge Solution 1064 - Solution in C






Solution in C 

#include<stdio.h>
int main()
{
float a[6],sum=0,avg;
int i,j=0;
for(i=0;i<6;i++)
{
scanf("%f",&a[i]);
if(a[i]>0)
{
sum=sum+a[i];
j=j+1;

}
}
avg=sum/j;
printf("%d valores positivos\n",j);
printf("%.1f\n",avg);
}



~~~~~~Happy Coding~~~~~~

No comments

Powered by Blogger.