Advertisement
dzieciol

8.5.2

Jan 26th, 2015
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <cmath>
  5. using namespace std;
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.     cout<<"podaj wielkość tablicy";
  10.     int n,i;
  11.    
  12.     cin>>n;
  13.     int tab[n];
  14.     cout<<"podaj "<<n<<"elementow tablicy"<<endl;
  15.     for (i=1 ; i<=n ; i++){
  16.     cin>> tab[i];
  17.     cout<<endl;}
  18.     cout<<"wynik";
  19.     for (i=1;i<=n ; i++){
  20.     int j=i*i;
  21.     if (j<=n)
  22.     cout<<tab[j]<<endl;}
  23.    
  24.    
  25.   system("PAUSE"); 
  26.   return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement