chore(Java) : add nearly lucky number

pull/865/head
Ayush Mandal 2022-10-01 12:25:42 +05:30 committed by GitHub
parent 62907b69ec
commit 2b971592f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import java.util.*;
public class nearlyLuckyNumberCF {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
long n = in.nextLong();
int count = 0;
while(n > 0){
if(n % 10 == 4 || n % 10 == 7){
count++;
}
n = n/10;
}
if(count == 7 || count == 4)
System.out.print("YES");
else
System.out.print("NO");
}
}