NotAlpha102

Multiplication Table

Mar 14th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. main()
  4. {
  5.     ios_base::sync_with_stdio(false);
  6.     cin.tie(NULL);
  7.     long long int n,x,i,j, counter=0;
  8.     cin>>n>>x;
  9.     long long int arr[n][n];
  10.     for(i=0; i<n;i++)
  11.     {
  12.         for(j=0;j<n;j++)
  13.         {//To fill the array with multiplication values.
  14.             arr[i][j]=(i+1)*(j+1);
  15. //            cout<<arr[i][j];
  16.         }
  17.     }
  18.     for(i=0; i<n;i++)
  19.     {
  20.         for(j=0;j<n;j++)
  21.         {
  22.             if(arr[i][j]==x)
  23.             {
  24.                 counter++;
  25.             }
  26.         }
  27.     }
  28.     cout<<counter;
  29.  
  30.  
  31.  
  32. }
Add Comment
Please, Sign In to add comment