Advertisement
WiktorMalisak

Zad 11

Apr 30th, 2020
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int x, tabA[5], tabB[5], tabC[5];
  10.     srand(time(NULL));
  11.     cout<< "Podaj maksymalny zakres wylosowanych liczb(od 0 do): ";
  12.     cin>>x;
  13.     for (int i=0;i<5;i++)
  14.         {
  15.         tabA[i]=rand()%(x+1);
  16.         tabB[i]=rand()%(x+1);
  17.         tabC[i]=tabA[i]+tabB[i];
  18.         }
  19.     cout<<"Tablica A: ";
  20.     for (int i=0;i<5;i++)
  21.         {
  22.         cout<<tabA[i]<<", ";
  23.         }
  24.     cout<<endl;
  25.     cout<<"Tablica B: ";
  26.     for (int i=0; i<5; i++)
  27.         {
  28.         cout<<tabB[i] << ", ";
  29.         }
  30.     cout<<endl;
  31.     cout<<"Tablica C: ";
  32.     for (int i=0; i<5; i++)
  33.         {
  34.         cout<<tabC[i]<<", ";
  35.         }
  36.     cout<<endl;
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement