Home > Back-end >  C language for bosses
C language for bosses

Time:09-22

Screen a math problem, ask users to answer, if the user have the wrong number, is displayed "think again", and then continue to show the title, until the user right, shows the "congratulations you're right", and exit the application

CodePudding user response:

#include
#include
#include
Int main ()
{
Int answer;//look at what's your answer type, define your own type
While (1)
{
Printf (" (your math subject:... ) ");
//the answer is what kind of read, what type for the integer variables answer here for example
If (the scanf (" % d ", & amp; Answer)=(fill in the correct answer here))
{
Printf (" congratulations you're right ");
break;
}
The else
{
Printf (" think again ");
System (" CLS ");
}
}
system("pause");
}
  • Related