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 |
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?
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
could you please send the program code for multiplying sparse matrix in c????
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
main() { int i=5,j=6,z; printf("%d",i+++j); }
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
main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])
main() { int i=5; printf("%d",++i++); }
main() { clrscr(); } clrscr();
void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(ā%dā,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(ā%dā,*cptr); }
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }