Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int x, tabA[5], tabB[5], tabC[5];
- srand(time(NULL));
- cout<< "Podaj maksymalny zakres wylosowanych liczb(od 0 do): ";
- cin>>x;
- for (int i=0;i<5;i++)
- {
- tabA[i]=rand()%(x+1);
- tabB[i]=rand()%(x+1);
- tabC[i]=tabA[i]+tabB[i];
- }
- cout<<"Tablica A: ";
- for (int i=0;i<5;i++)
- {
- cout<<tabA[i]<<", ";
- }
- cout<<endl;
- cout<<"Tablica B: ";
- for (int i=0; i<5; i++)
- {
- cout<<tabB[i] << ", ";
- }
- cout<<endl;
- cout<<"Tablica C: ";
- for (int i=0; i<5; i++)
- {
- cout<<tabC[i]<<", ";
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement