Ankit_132

B

Sep 9th, 2023
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin>>n;
  10.  
  11.     for(int i=0; i<=n; i++)
  12.     {
  13.         int ok = 0;
  14.         for(int j=1; j<=9 && !ok; j++)
  15.         {
  16.             if(n%j != 0)    continue;
  17.  
  18.             if(i%(n/j) == 0)
  19.                 ok = j;
  20.         }
  21.  
  22.         if(!ok)     cout<<'-';
  23.         else        cout<<ok;
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment