Advertisement
Wojtekd

Suma Elementów Tablicy [Wskaźniki]

Dec 15th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. double SumaElementowTablicy(double t[]);
  4.  
  5. int main( void )
  6. {
  7.     double tab[] = {0.5, 15.3, 7.5, 8.4, 2.2};
  8.     printf("%f",SumaElementowTablicy(tab));
  9.     return 0;
  10. }
  11. double SumaElementowTablicy(double t[])
  12. {
  13.     double suma = 0;
  14.     for(int i = 0; i < 5; i++)
  15.     {
  16.         suma += t[i];
  17.     }
  18.     return suma;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement