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
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 |
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 |
All the combinations of prime numbers whose sum gives 32
write a program to count the number the same (letter/character foreg: 's') in a given sentence.
C statement to copy a string without using loop and library function..
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
18 Answers HCL, IBM, Infosys, LG Soft, Satyam,
main() { extern int i; i=20; printf("%d",i); }
how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.
19 Answers Cap Gemini, Infosys,
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
given integer number,write a program that displays the number as follows: First line :all digits second line : all except the first digit . . . . Last line : the last digit
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.