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 |
write a program to Insert in a sorted list
write a origram swaoing valu without 3rd variable
What is the main difference between STRUCTURE and UNION?
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,
void ( * abc( int, void ( *def) () ) ) ();
main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }
how can i cast a char type array to an int type array
how to return a multiple value from a function?
write a c program to Reverse a given string using string function and also without string function
main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }
void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.