that_one_nigga_you_k

noite dos vinhos

Nov 12th, 2023 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int X, N;
  5.     int soma_tacas = 0;
  6.     scanf("%d", &X);
  7.  
  8.     for (int i = 0; i < X; i++) {
  9.         int nota;
  10.         float soma = 0;
  11.         int qtd_notas = 0;
  12.        
  13.         scanf("%d", &nota);
  14.         while (nota != 0) {
  15.             soma = soma + nota;
  16.             qtd_notas++;
  17.             scanf("%d", &nota);
  18.         }
  19.        
  20.         int media = soma / qtd_notas;
  21.         soma_tacas = soma_tacas + media;
  22.     }
  23.  
  24.     printf("Elas beberam %d ta�as!\n", soma_tacas);
  25.  
  26.     return 0;
  27. }
  28.  
Add Comment
Please, Sign In to add comment