Code for Program to get answer of inventor of c. Allow user to give answer in 3 attempts in C Programming
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char a[20];
int i=0;
clrscr();
do
{
printf("\nWho is inventor of c : ");
scanf("%s",a);
if(strcmp(a,"denishrich")==0)
{
printf("\n good");
i=5;
break;
}
elseif(i==2)
break;
printf("\ntry again ");
i++;
}while(i<3);
if(i!=5)
printf("\n correct answer is denishrich ");
getch();
}
/*
******
output
******
Who is inventor of c : den
try again
Who is inventor of c : denishrich
good
*/