Wap to enter a string from the keyboard and print the total number of alphabet and print the total number of digits and print the total number of special character using byfferedreader
Answers
Answered by
0
import java.io.*;
class Frequency
{
public static void main( )throws IO Exception
{
BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));
int i,l,count=0,s=0,t=0;
System.out.println("Enter your string");
String a=ob.readLine( );
l=a.length( );
for( i=0;i<l;i++)
{
char ch=a.At(i);
if(Character.isLetter(ch))
{
count++;
}
else if(Character.isDigit(ch))
{
s++;
}
else
{
t++;
}
System.out.println("total number of alphabets are "+count);
System.out.println("total number of digits are "+s);
System.out.println("total number of special characters are "+t);
}
}
After for loop pls write the 1st correct line ,i have attached to pic@
Hope it will help you@
For more java related doubts follow me
class Frequency
{
public static void main( )throws IO Exception
{
BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));
int i,l,count=0,s=0,t=0;
System.out.println("Enter your string");
String a=ob.readLine( );
l=a.length( );
for( i=0;i<l;i++)
{
char ch=a.At(i);
if(Character.isLetter(ch))
{
count++;
}
else if(Character.isDigit(ch))
{
s++;
}
else
{
t++;
}
System.out.println("total number of alphabets are "+count);
System.out.println("total number of digits are "+s);
System.out.println("total number of special characters are "+t);
}
}
After for loop pls write the 1st correct line ,i have attached to pic@
Hope it will help you@
For more java related doubts follow me
Attachments:
amannishad0512p5zxh6:
Bro,1 mistake in my answer is that
Similar questions
Math,
7 months ago
Computer Science,
1 year ago
History,
1 year ago
Math,
1 year ago
Physics,
1 year ago