Saturday, March 12, 2016

java sample question- Alphabet Frequency

import java.io.*;
class FREQUENCY
{
public static void main()throws IOException
{
InputStreamReader y=new InputStreamReader(System.in);
BufferedReader x=new BufferedReader(y);
String s=new String();
int l,i,j,c=0;
System.out.println(“Enter a String:”);
s=x.readLine();
s=s.toUpperCase();
l=s.length();
for(i=65;i<=90;i++)
{
for(j=0;j0)
System.out.println(“Alphabet ” + (char)i + ” appears ” + c + ” time(s)”);
c=0;
}
}
}

Related Article  of JAVA

No comments:

Post a Comment