#include <stdio.h>
#include <string.h>
int main()
{
char string[1000];
int d = 0, count[26] = {0}, x;
printf("Enter a string : \n");
gets(string);
while (string[d] != '\0') {
if (string[d] >= 'a' && string[d] <= 'z') {
x = string[d] - 'a';
count[x]++;
}
d++;
}
for (d = 0; d< 26; d++)
printf("%c occurs %d times in the string.\n", d + 'a', count[d]);
return 0;
}
OUTPUT : -
#include <string.h>
int main()
{
char string[1000];
int d = 0, count[26] = {0}, x;
printf("Enter a string : \n");
gets(string);
while (string[d] != '\0') {
if (string[d] >= 'a' && string[d] <= 'z') {
x = string[d] - 'a';
count[x]++;
}
d++;
}
for (d = 0; d< 26; d++)
printf("%c occurs %d times in the string.\n", d + 'a', count[d]);
return 0;
}
OUTPUT : -
Follow
Me On Social Media :-
INSTA photography page :- https://www.instagram.com/photo_mania_hub/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Insta photography link :- https://www.instagram.com/photo_mania_hub/
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments