Advertisement
sekowshaman

Untitled

Nov 22nd, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. int main ()
  4. {
  5. int i;
  6. float N[6], cont, acom;
  7. cont=0;
  8. acom=0;
  9. for (i=0; i<6; i++)
  10. {
  11. scanf("%f", &N[i]);
  12. }
  13. for (i=0; i<6; i++)
  14. {
  15. if (N[i]>=0)
  16. {
  17. cont++;
  18. acom=acom+N[i];
  19. }
  20. }
  21. printf("%f, numeros positivos \n", cont);
  22. acom = acom/cont;
  23. printf("A media dos numeros é: %f \n", acom);
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement