Advertisement
rdsedmundo

Cofre.c

Jan 8th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int i;
  5.  
  6.     for(i = 0;; i++) {
  7.         int n, j;
  8.  
  9.         scanf("%d", &n);
  10.  
  11.         if(!n)
  12.             break;
  13.  
  14.         int diferenca[n];
  15.  
  16.         for(j = 0; j < n; j++) {
  17.             int Joao, Ze;
  18.             scanf("%d %d", &Joao, &Ze);
  19.  
  20.             if(!j)
  21.                 diferenca[j] = (Joao - Ze);
  22.             else
  23.                 diferenca[j] = diferenca[j-1] + (Joao - Ze);
  24.         }
  25.  
  26.         printf("Teste %d\n", i + 1);
  27.         for(j = 0; j < n; j++)
  28.             printf("%d\n", diferenca[j]);
  29.  
  30.     }
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement