fork download
  1. #include<stdio.h>
  2.  
  3. int main(){
  4. int n, j, z, i, acum, conjunto = 1;
  5. scanf("%i", &n);
  6. while(n != 0){
  7. acum = 0;
  8. printf( "Teste %d\n", conjunto);
  9. conjunto++;
  10. for(i = 0; i < n; i++){
  11. scanf("%i %i", &j, &z);
  12. acum += j - z;
  13. printf("%i\n", acum);
  14. }
  15. printf("\n");
  16. scanf("%i", &n);
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 9432KB
stdin
3
20 25
10 5
10 10
4
0 5
12 0
0 20
17 1
0
stdout
Teste 1
-5
0
0

Teste 2
-5
7
-13
3