#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char *names[] = {"Sanjukta", "Arindam", "Chandan",
"Arnab", "Shivaji" };
int i,count,tcount=0;
char *s,ch;
clrscr();
printf ("ENTER THE CHARACTER :");
scanf ("%c",&ch);
for (i=0;i<=4;i++)
{
count =0;
s =names[i];
while (*s)
{
if (*s == ch)
count++;
s++;
}
printf ("\n%s CONTAINS %d %c",names[i],count,ch);
tcount = tcount + count;
}
printf ("\nTOTAL NO. OF %c = %d",ch,tcount);
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char *names[] = {"Sanjukta", "Arindam", "Chandan",
"Arnab", "Shivaji" };
int i,count,tcount=0;
char *s,ch;
clrscr();
printf ("ENTER THE CHARACTER :");
scanf ("%c",&ch);
for (i=0;i<=4;i++)
{
count =0;
s =names[i];
while (*s)
{
if (*s == ch)
count++;
s++;
}
printf ("\n%s CONTAINS %d %c",names[i],count,ch);
tcount = tcount + count;
}
printf ("\nTOTAL NO. OF %c = %d",ch,tcount);
getch();
}
0 comments :
Post a Comment