mollevi99

Órai4

Oct 11th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     cout << "Hello world!" << endl;
  6.     int t[10];
  7.     //feltöltés
  8.     int i=0;
  9.     while(i<10){
  10.         cin>>t[i];
  11.         i++;
  12.     }
  13.     i=0;
  14.     while(i<10){
  15.         cout<<endl<<i+1<<". elem:"<<t[i]<<endl;
  16.         i++;
  17.     }
  18.     //keresések
  19.     int db=0;
  20.     i=0;
  21.     while(i<10){
  22.         if(t[i]%2==0){
  23.             db++;
  24.         }
  25.         i++;
  26.     }
  27.     cout<<"paros:"<<db<<endl;
  28.     i=0;
  29.     double osszeg=0;
  30.  
  31.     while(i<10){
  32.         osszeg+=t[i];
  33.         i++;
  34.     }
  35.     cout<<"osszeg: "<<osszeg<<endl;
  36.     double atlag;
  37.     atlag=osszeg/i;
  38.     cout<<"atlag="<<atlag;
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment