-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPangram.java
More file actions
42 lines (34 loc) · 988 Bytes
/
Copy pathPangram.java
File metadata and controls
42 lines (34 loc) · 988 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
39
40
41
42
//Pangrams are the sentences which contains all alphabets
import java.util.Scanner;
public class Pangram {
static char[] ch = new char[26];
static String str;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
str = scanner.nextLine();
str = str.toLowerCase();
boolean isPangram = true;
alphaArray();
for (int i = 0; i < 26; i++) {
if (isIn(ch[i]) == false) {
isPangram = false;
}
}
System.out.println("Is input string is a pangram :" + isPangram);
}
public static void alphaArray() {
int temp = 0;
for (char i = 'a'; i <= 'z'; i++) {
ch[temp] = i;
temp++;
}
}
public static boolean isIn(char c) {
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == c) {
return true;
}
}
return false;
}
}