trojanxem

Untitled

Mar 26th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     double tablica[8];
  8.     int i,j,k,a,b,ind1,ind2;
  9.     double suma_dodatnia = 0,suma_ujemna = 0;
  10.    
  11.    
  12.     for(i=0; i < 8; i++)
  13.     {
  14.             printf("Podaj %d element: \n", i);
  15.             scanf("%d", &tablica[i]);
  16.             if ( tablica[i] > 0 )
  17.             {
  18.                  suma_dodatnia+=tablica[i];
  19.                  }
  20.                  else
  21.                  suma_ujemna+=tablica[i];
  22.                  }
  23.                  
  24.                            
  25.                            printf("%d\n%d" , suma_dodatnia,suma_ujemna);
  26.                            
  27.                            
  28.                            
  29.                            getch();
  30.                            return 0;
  31.                            }
Advertisement
Add Comment
Please, Sign In to add comment