Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,suma=0, liczba,i=0;
  8.     cout<<"Ile podasz liczb?";
  9.     cin>>n;
  10.     while(i<n){
  11.         cout<<"Podaj liczbę: ";
  12.         cin>>liczba;
  13.         suma=suma+liczba;
  14.         i++;
  15.     }
  16.     cout<<"Średnie podanych" << n <<" liczb rowna sie: "<< static_cast<float>(suma)/static_cast<float>(n);
  17.    
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement