WAP TO ACCEPT STRING AND COUNT A COMES N TIMES B COMES N
TIMES C COMES N TIMES D COMES N TIMES AND SO ON.........
AT LAST UNTIL Z COMES N TIMES...............
Answer Posted / vignesh1988i
this logic is for 'A'(capital) to 'z'(small)......
#include<stdio.h>
#include<conio.h>
void main()
{
int count;
char str[100];
printf("enter the string :");
gets(str);
for(int i=65;i<=122;i++)
{
count =0;
for(int j=0;str[j]!='\0';j++)
{
if(str[j]==i)
count++;
}
printf("the character %c occurs %d times \n",i,count);
}
getch();
}
thank you
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
Which header file is used for clrscr?
What is wrong with this program statement? void = 10;
List the different types of c tokens?
Why is not a pointer null after calling free?
Is return a keyword in c?
What is #define?
Explain what is the concatenation operator?
What is the use of a static variable in c?
What are the main characteristics of c language describe the structure of ac program?
What is c language and why we use it?
What is difference between structure and union with example?
Explain what does it mean when a pointer is used in an if statement?
define string ?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff