Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to get answer of inventor of c. Allow user to give answer in 3 attempts

Posted By: Jasmine Brown     Category: C Programming     Views: 1770

Program to get answer of inventor of c. Allow user to give answer in 3 attempts

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
*/
  
Share: 



Jasmine Brown
Jasmine Brown author of Program to get answer of inventor of c. Allow user to give answer in 3 attempts is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!