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
What is the Purpose of 'extern' keyword in a function declaration?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
How can I call fortran?
What is the value of uninitialized variable in c?
What are the scope of static variables?
What do you mean by a sequential access file?
What is else if ladder?
What are the characteristics of arrays in c?
Tell me can the size of an array be declared at runtime?
Describe the difference between = and == symbols in c programming?
What are the types of operators in c?
Write a program to find the biggest number of three numbers in c?
Explain what is the purpose of "extern" keyword in a function declaration?
Why is struct padding needed?
why do some people write if(0 == x) instead of if(x == 0)?