I have a program due in a couple of hours and I am completelystuck. The problem
ID: 3612311 • Letter: I
Question
I have a program due in a couple of hours and I am completelystuck. The problem reads "Write a program that will help anelementary school student learn multiplication. Use rand toproduce two positive one-digit integers. it should then typea questions such as: How much is 6 times 7? The studentthen types the answer. Your program checks the studentsanswer. If the answer is correct print very good and then askanother multiplication question. If the answer is wrong,print no Please try again Then let the student try the samequestion again repeatedly until the student finally gets the rightanswer" In addition to this, the program must allow provide aiteration as well. Also, I must use an additional function ontop of the main function. Presently I have...#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int gennumbers ();
int main (void)
{
int answer;
int questions;
int counter;
int correct;
correct = gennumbers();
counter = 1;
printf ("How many problems would you like towork on today?");
scanf ("%d", &questions);
while (counter <= questions) {
scanf("%d", &answer);
if (answer== correct){
printf("Great Job ");
counter++;
}
else{
printf("Try again ");
} /* End of While */
}
return 0;
}
int gennumbers ( void )
{
int factora;
int factorb;
int product;
factora = 0 + ( rand() % 9);
factorb = 0 + ( rand() % 9);
product = factora * factorb;
printf("How much is %d times %d? ", factora,factorb);
return product;
return factora;
return factorb;
}
I don't know if that will be of any help. Please please helpme on this I am completely stuck.
Explanation / Answer
#include #include #include int gennumbers (); int main (void) { int answer=-1; int questions; int counter; int correct; counter = 1; printf ("How many problems would you like towork on today?"); scanf ("%d", &questions); while(counterRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.