Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void multiplication (void);
int main()
{
multiplication();
}
void multiplicaton (void)
{
int x, y, answer, guess;
srand(time(NULL));
x = rand()%9 + 1;
y = rand()%9 + 1;
answer = x*y;
printf( "what is %d multplied by %d\n" , x , y);
scanf("%d", &guess);
while( guess != answer)
{
printf("No. Please try again");
}
printf(" Very Good\n");
}
Basically the function is supposed to be executed almost as it was the main function and be the only thing really doing anything during the program. I can't seem to call it in the main function. here is the question I have to answer:
2- Computers are playing an increasing role in education. Define a function called multiplication that takes no arguments and returns nothing to 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 function 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. Use this function in a program to check the correctness of the function.