write a program to count the number the same
(letter/character foreg: 's') in a given sentence.

Answers were Sorted based on User's Feedback



write a program to count the number the same (letter/character foreg: 's') in a given sen..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],n;
int count=0;
printf("enter the string");
gets(a);
printf("enter the letter to be searched");
scanf("%c",&n);
for(int i=0;a[i]!='\0';i++)
{
if(a[i]==n)
{
count++;
}
}
printf("so the number of occurances of the given %c
is ",count);
getch();
}

Is This Answer Correct ?    12 Yes 9 No

write a program to count the number the same (letter/character foreg: 's') in a given sen..

Answer / sankara subramanian.n

#include<stdio.h>
#include<conio.h>
void main()
{
char a[100];
int i,count=1;
clrscr();
printf("Enter the string:");
gets(a);
for(i=0;a[i]!='\0';i++)
{
count++;
}
getch();
}

Is This Answer Correct ?    0 Yes 9 No

Post New Answer

More C Code Interview Questions

hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


could you please send the program code for multiplying sparse matrix in c????

0 Answers  


main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?

2 Answers  


main() { int i=5,j=6,z; printf("%d",i+++j); }

2 Answers  






Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false

1 Answers   Cognizant, lenovo,


main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

6 Answers  


Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


main() { int i=5; printf("%d",++i++); }

1 Answers  


main() { clrscr(); } clrscr();

2 Answers  


void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(ā€œ%dā€,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(ā€œ%dā€,*cptr); }

1 Answers  


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  


Categories