Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     //zmienne
  9.     float tab[5];
  10.     float suma = 0;
  11.     float srednia;
  12.  
  13.     //petla for
  14.     for(int i = 0; i < 5; i++)
  15.     {
  16.         float liczba = tab[i];
  17.         cin >> liczba;
  18.         suma += liczba;
  19.     }
  20.  
  21.     srednia = suma / 5;
  22.     cout << "Srednia wynosi: " << srednia << endl;
  23.  
  24.     getchar();
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement