using for loop and functions to create a basic menu
hi, I'm trying to make a function that when it is executed asks the user for three options multilplication, division and exit. If the user the user makes a wrong option, the program re-executes asking the user to enter the right option and make the selection again. Can someone please help me on where I'm going wrong.Here is my code:
Code:
#include <stdio.h>
#include <stdlib.h>
int print_Menu();
int main(void)
{
printf("This program tests you with ten questions.\n 1) Multiplication\n 2) Division\n 3) Exit\n Please make a selection (1-3)", print_Menu);
return 0;
}
int print_Menu()
{
int i;
for (i=1; i<4; i++)
{
scanf("%d", &i);
if (i==1)
printf("Please give the answers to the following additions:");
if (i==2)
printf("Please give the answers to the following division questions:");
if (i==3)
printf("Press the Enter key to exit");
else
printf("Incorrect choice entered: Please select from one to three numbers");
}
}