-
Notifications
You must be signed in to change notification settings - Fork 0
/
YT39.java
40 lines (35 loc) · 947 Bytes
/
YT39.java
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
import java.io.*;
class YT39
{
public static void main(String[] args)throws IOException
{
String str;
int L, x;
int cd=0, ca=0, cs=0;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the string");
str=br.readLine().toUpperCase();
L=str.length();
for(int i=0; i<L; i++)
{
x=str.charAt(i);
if(x>=65 && x<=90)
{
ca++;
}
else if(x>=48 && x<=57)
{
cd++;
}
else
{
cs++;
}
}
System.out.println("No of digits: " + cd);
System.out.println("No of alphabets: " + ca);
System.out.println("No of sp char.: " + cs);
//kapildev@83
}
}