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...............
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vignesh1988i
m minor modification
#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]==(char)i)
{
printf("the character %c occurs %d times \n",i,count);
count++;
}
}
}
getch();
}
thank you
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / priyanka
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,count;
char str[100];
clrscr();
printf("enter the string :");
gets(str);
for(i=65;i<=122;i++)
{
count =1;
for(j=0;str[j]!='\0';j++)
{
if(str[j]==i)
count++;
}
printf("the character %c occurs %d times \n",i,count);
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Explain what a Binary Search Tree is.
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15
Write a program to find the smallest and largest element in a given array in c language
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What is a void pointer in c?
What is meant by inheritance?
What is the difference between getch() and getche()?
What is modifier & how many types of modifiers available in c?
int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
0 Answers Aegis, CDAC, Infosys,
what is the purpose of the code, and is there any problem with it. unsigned int v[10]; unsigned int i = 0; while (i < 10) v[i] = i++;