Advertisement
joaopaulofcc

Untitled

Jun 17th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int idade, nPessoas, cont, idadeT;
  6. float peso, mediaidad;
  7.  
  8. nPessoas = 0;
  9. cont = 0;
  10. idadeT = 0;
  11.  
  12. while (nPessoas < 4)
  13. {
  14. nPessoas = nPessoas + 1;
  15.  
  16. scanf("%i", &idade);
  17. scanf("%f", &peso);
  18.  
  19. if ( (peso >= 0) && (idade >= 0) )
  20. {
  21. idadeT = idadeT + idade;
  22.  
  23. if (peso > 90)
  24. {
  25. cont = cont + 1;
  26. }
  27. }
  28. }
  29.  
  30. mediaidad = idadeT / (float) nPessoas;
  31.  
  32. printf("Qtd pessoas > 90 Kg: %i\n", cont);
  33.  
  34. printf("Idade média: %.2f\n", mediaidad);
  35.  
  36. return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement