forked from shivammaniharsahu/Leetcode-Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtre.cpp
More file actions
38 lines (32 loc) · 640 Bytes
/
tre.cpp
File metadata and controls
38 lines (32 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<bits/stdc++.h>
using namespace std;
int main()
{
int left, right;
cin>>left>>right;
vector <int> v;int h=0,k=0,y,i,b;
for(i=left;i<=right;i++)
{ y=i;h=0;
if(i%10==0)
continue;
while(y>0)
{
k=y%10;
if((i%k)==0)
{
continue;
}
else {
h=1;break;
}
y=y/10;
}
if(h==0)
cout<<i<<" ";
}
for(int j=0;j<v.size();j++)
{
cout<<v[j]<<" ";
}
return 0;
}