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 |
Hierarchy decides which operator a) is most important b) is used first c) is fastest d) operates on largest numbers
a character variable can at a time store a) 1 character b) 8 characters c) 254 characters d) none of the above
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
What does c mean in basketball?
Explain the advantages of using macro in c language?
if the address of a[1,1] and a[2,1] are 1000 and 1010 respectively and each occupies 2 bytes then the array has been stored in what order?
4 Answers Amazon, Apple, Bata, Google, NASA,
what is develop in c language
How can I ensure that integer arithmetic doesnt overflow?
Should I learn data structures in c or python?
When would you use a pointer to a function?
2. Write a function called hms_to_secs() that takes three int values—for hours, minutes, and seconds—as arguments, and returns the equivalent time in seconds.. Create a program that exercises this function by repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns.
what are the files which are automatically opened when a c file is executed?