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

How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

0 Answers  


main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }

1 Answers  


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

1 Answers  


Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];

1 Answers  






main() { int i=5; printf(“%d”,i=++i ==6); }

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).

13 Answers   Intel, Microsoft, TCS,


how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!

8 Answers   GATE,


Write a routine to implement the polymarker function

0 Answers   TCS,


Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.

1 Answers   Samar State University,


#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }

1 Answers  


Categories