forked from Coding-Cartel/CodeForces-Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlucky_number.cpp
48 lines (47 loc) · 944 Bytes
/
lucky_number.cpp
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
39
40
41
42
43
44
45
46
47
48
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int count=0,temp=n;
while(n>0){
count++;
n /=10;
}
switch (count)
{
case 1:
if(temp%4==0 || temp%7==0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
break;
case 2:
if(temp%4==0 || temp%7==0 || temp%47==0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
break;
case 3:
if(temp%4==0 || temp%7==0 || temp%47==0 || temp%744==0 || temp%477==0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
break;
case 4:
if(temp%4==0 || temp%7==0 || temp%47==0 || temp%744==0 || temp%477==0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
break;
}
return 0;
}