Computer Science, asked by skanishka848, 5 months ago

wap to accept a string and to find the frequency of each alphabet in the same string​

Answers

Answered by Anonymous
21

Answer:

C program to find the frequency of characters in a string

int main() { char string[100]; int c = 0, count[26] = {0}, x;

if (string[c] >= 'a' && string[c] <= 'z') { x = string[c] - 'a'; count[x]++; }

for (c = 0; c < 26; c++) printf("%c occurs %d times in the string.\ n", c + 'a', count[c]);

I hope it helps u ☺️✌️..........

Answered by shreesoham4212
2

Explanation:

import java.util.*;

public class frequency

{

public static void main (string args[])

{

scanner sc= new Scanner (System.in);

system.out.println("Enter any string");

string s= sc.nextline();

s=s.tolowercase();

int l=sc.length();

char ch;

System.out.println(“Alphabet\tFrequency”);

int count=0;

for(char i=’a’; i<=’z’; i++)

{

int c =0;

for(int j=0; j<l; j++);

{

ch=s.charAt(j);

if(ch==i)

Similar questions