Advertisement
Guest User

gfdshagdshdgthdfhga

a guest
Oct 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int n;
  7.  
  8. cout << "Podaj rozmiar tablicy:" << endl;
  9. cin >> n;
  10.  
  11. int * tab = new int[n];
  12. cout << "A) "<<endl;
  13. for(int i =0;i<=n-1;i++){
  14. tab[i]=i;
  15. }
  16. for(int i =0;i<=n-1;i++){
  17. cout << tab[i] << " ";
  18. }
  19.  
  20. cout <<endl<< "B) "<<endl;
  21.  
  22. for(int i =7;i<=n+6;i++){
  23. tab[i]=i;
  24. }
  25. for(int i =7;i<=n+6;i++){
  26. cout << tab[i] << " ";
  27. }
  28.  
  29. cout <<endl<< "C) "<<endl;
  30.  
  31. for(int i =0;i<=n;i = i +4){
  32. tab[i]=i;
  33. }
  34. for(int i =0;i<=n;i = i +4){
  35. cout << tab[i] << " ";
  36. }
  37. cout <<endl<< "D) "<<endl;
  38. for(int i =1;i<=n; i = i*2){
  39. tab[i]=i;
  40. }
  41. for(int i =1;i<=n; i = i*2){
  42. cout << tab[i] << " ";
  43. }
  44. cout <<endl<< "E) "<<endl;
  45. for(int i =2;i<=n+1; i++){
  46. tab[i]=i;
  47. }
  48. for(int i =2;i<=n+1; i++){
  49. cout << tab[i] << " ";
  50. }
  51. delete [] tab;
  52.  
  53.  
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement