/*WAP TO PRINT THE NO.OF OCCURENCES OF RESPECTIVE ALPHABET A-Z
IN THE ENTRERED LINE.*/
#include<stdio.h>
#include<conio.h>
void main()
{
char a[20],b;
int i,c=0;
clrscr();
puts("\n\nENTER THE LINE:");
gets(a);
printf("\n\nENTERED LINE IS:");
puts(a);
printf("\n\nENTER THE LETTER TO BE COUNTED:");
scanf("%s",&b);
for(i=0;a[i]!='\0';i++)
if(a[i]==b)
c++;
printf("\n\nTHE LETTER OCCUR %d TIMES IN THE LINE",c);
printf("\n\nABHISHEK WADHWA");
getch();
}
/*------------------------------------------------------------------
OUTPUT
--------------------------------------------------------------------
ENTER THE LINE:
ABHISHEK WADHWA
ENTERED LINE IS:ABHISHEK WADHWA
ENTER THE LETTER TO BE COUNTED:A
THE LETTER OCCUR 3 TIMES IN THE LINE
ABHISHEK WADHWA
*/
No comments:
Post a Comment