Computer Science, asked by vishalsharmasharma25, 10 months ago

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 amannishad0512p5zxh6
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
Attachments:

amannishad0512p5zxh6: Bro,1 mistake in my answer is that
amannishad0512p5zxh6: after for loop there is first line
amannishad0512p5zxh6: char ch=
amannishad0512p5zxh6: when i wrote char
amannishad0512p5zxh6: it show an error
amannishad0512p5zxh6: but full 1st line after for loop is
Similar questions