
Strings and Standard Functions II-177
{
char ans[8];
int i;
clrscr();
for(i=1;i<=3;i++)
{
printf("\nWhat is the currency of India?");
scanf("%s",ans);
fflush(stdin);
if(stricmp(ans,"Rupees")==0)
{
printf("\nAnswer is Correct.");
exit(1);
}
else
if (i<3)
printf("\n Try Again !\n");
}
clrscr();
printf("\NCurrency of India is Rupees.");
}
OUTPUT:
What is the currency of India?Rupee
Try Again !
What is the currency of India?Ruppea
Try Again !
What is the currency of India?Rupees
Answer is Correct.
19. Use of functions such as strcmp, strcat, and strlen
void main()
{
char str1[20]="C is", str2[20]="easy language";
int x,y,z;
clrscr();
printf("\n Source String:-%s",str1);
printf("\n ...