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


Please Help Members By Posting Answers For Below Questions

the question is that what you have been doing all these periods (one year gap)

1611


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

700


Why are all header files not declared in every c program?

592


What is output redirection?

680


What is calloc()?

618






What is the difference between ++a and a++?

682


Why is python slower than c?

593


What are pointers really good for, anyway?

606


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2296


what do the 'c' and 'v' in argc and argv stand for?

636


What are structure types in C?

654


What are valid signatures for the Main function?

694


What does p mean in physics?

577


What is difference between array and pointer in c?

532


how could explain about job profile

1446