-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepeat.java
More file actions
33 lines (28 loc) · 713 Bytes
/
repeat.java
File metadata and controls
33 lines (28 loc) · 713 Bytes
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
/* Name: Edwin Joseph
Roll no: 31
Batch:S3 CSE B
Experiment: Palindrome or not
*/
import java.util.Scanner;
class repeat
{
public static void main(String[] args)
{
Scanner sc =new Scanner(System.in);
System.out.println("Enter String : ");
String str = sc.nextLine();
int i,j,c=0;
char[] a=new char[str.length()];
int length= str.length();
System.out.println("Enter the letter whose frequency is to be found");
char b= sc.next().charAt(0);
for(i=0;i<length;i++)
{a[i]= str.charAt(i);
}
for(i=0;i<length;i++)
{ if(a[i]==b)
c++;
}
System.out.println("The frequency is "+c);
}
}