Write a program that will help an elementary school student learn multiplication
ID: 3663620 • Letter: W
Question
Write a program that will help an elementary school student learn multiplication. Use the random module to produce two positive one-digit integers. The program should then display a question, such asHow much is 6 times 7?
The student then types the answer.
Next, the program checks the student’s answer. If it is correct, printthe string "Very good!" on the screen and ask another multiplication question.
If the answer iswrong, display "No. Please try again." and let the student try the same question again repeatedlyuntil the student finally gets it right.
A separate function should be used to generate each newquestion. This method should be called once when the program begins execution and each time theuser answers the question correctly. [Hint: To convert the numbers for the problem into strings forthe question, use function str. For example, str( 7 ) returns "7".]
Explanation / Answer
/* Name: Copyright: Deitel C How to Program Author: StackOverflow1453 Date: 16.04.2013 20:09:18 Description: Computers are playing an increasing role in education. Write a program that will help an elementary school student learn multiplication. Use rand to produce two positive one-digit integers. It should then type a question such as: How much is 6 times 7? The student then types the answer. Your program checks the student's answer. If it is correct, print "Very good!" and then ask another multiplication question. If the answer is wrong, print "No. Please try again." and then let the student try the same question again repeatedly until the student finally gets it right. */ #include #include #include void game(void); int main(void) { srand(time(NULL)); game(); return 0; } void game(void){ int choice=1; while(choice!=0){ int number1,number2,resultStudent,result,aha; number1=1+rand()%9; number2=1+rand()%9; result=number1*number2; printf("How much is %d times %d ?",number1,number2); scanf("%d",&resultStudent); while (resultStudent!=result) { printf("No. Please try again."); scanf("%d",&resultStudent); } printf("Very Good "); printf("Do you wanna play again?(0 for Exit): "); scanf("%d",&choice); if (choice!=0) printf("Hmm you wanna play again... "); } printf("Program is terminated."); }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.