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

Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


How do you write a program which produces its own source code as its output?

7 Answers  


In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

0 Answers   TCS,


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


write a program to Insert in a sorted list

4 Answers   Microsoft,


Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);

1 Answers  


write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 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,


#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

2 Answers  


Categories