Solution of URI 1060::Positive Numbers
Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problem, you will inform me by comment.
#include <stdio.h>
int main
()
{
float n[6];
int i,count=0;
for(i=0;i<6;i++) {
scanf("%f",&n[i]);
}
for(i=0;i<6;i++) {
if (n[i]>0) {
count++;
}
}
printf("%d valores positivos\n",count);
return 0;
}
No comments