Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lucky Number Problem #674

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions User/Java/LuckyNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.Scanner;

public class LuckyNumber {

public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int k = input.nextInt();
int count = 0;
while (n > 0) {
int lucky = 0;
char result[] = input.next().toCharArray();
for (int i = 0; i < result.length; ++i) {
if (result[i] == '4' || result[i] == '7') {
lucky += 1;
}
}
if (lucky <= k) {
count += 1;
}
n--;
}
System.out.println(count);
}
}
7 changes: 7 additions & 0 deletions User/Java/tanvir.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Name": "Tanvir Rahman",
"Occupation": "Student",
"UserName": "tanviranindo",
"StarredTheRepo": true,
"FavouriteQuote": "Try harder"
}