WAP in JAVA to check if all alphabets are present or not.
Answers
import java.util.*;
class alpha
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter a sentence : ");
String input = sc.nextLine();
int l = input.length();
boolean res = false;
if(l<26)
{
System.out.print("Not possible :-(");
System.exit(0);
}
for(char ch='A';ch <= 'Z';ch++)
{
if (input.indexOf(ch) < 0 && input.indexOf((char) (ch + 32)) < 0)
{
res=false;
}
else
{
res=true;
}
}
if(res=true)
{
System.out.print("All alphabets contained.");
}
else
{
System.out.print("All alphabets not present.");
}
}
}
Answer:
hey you can get it on stackoverflow
Explanation:
if you need any other check it in stackoverflow