Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <cstdlib>
  4.  
  5. #include <ctime>
  6.  
  7. using namespace std;
  8.  
  9. int Random (int a,int b)
  10. {
  11.     return a+rand()%(b-a-1);
  12. }
  13.  
  14. int main()
  15. {
  16.   srand(time(0));
  17.   int arr[5][3],bar[3];
  18.   for(int i=0;i<5;i++)
  19.   {
  20.     for(int j=0;j<3;j++)
  21.     {
  22.         arr[i][j]=Random(0,10);
  23.         cout<<"|"<<arr[i][j]<<"|";
  24.     }
  25.     cout<<endl;
  26.   }
  27.  
  28.   for(int i=0;i<5;i++)
  29.   {
  30.     bar[i]=1;
  31.     for(int j=0;j<3;j++)
  32.     {
  33.         bar[i]*=arr[i][j];
  34.     }
  35. }
  36.     for (int i=0;i<5;i++)
  37.     {
  38.     cout<<"|"<<bar[i]<<"|";
  39.     }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement