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 data structure in c language?
What is an identifier?
How can I use a preprocessorif expression to ?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
What is d scanf?
How many identifiers are there in c?
What is context in c?
What does %d do?
What are the 5 elements of structure?
Was 2000 a leap year?
what is a constant pointer in C
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Why are all header files not declared in every c program?
What does #pragma once mean?
Hai what is the different types of versions and their differences