Hi I am just a beginner in programming. Please help as I can't run the program.
Code:
#include<stdio.h>
void displayMenu();
void addition();
void looping();
void main()
{
displayMenu();
looping();
}
void displayMenu()
{
int choice;
printf("(1)Addition problem\n");
printf("(2)Subtraction problem\n");
printf("(3)Quit the Program\n");
printf("Plese press a number to make your selection: ");
scanf("%d",&choice);
}
void addition()
{
int a,b,c,d;
printf("2+3= \n");
scanf("%d",&a);
if(a==5)
printf("Right\n");
else
printf("Wrong\n");
printf("3+4= \n");
scanf("%d",&b);
if(b==7)
printf("Right\n");
else
printf("Wrong\n");
printf("6+2= \n");
scanf("%d",&c);
if(c==8)
printf("Right\n");
else
printf("Wrong\n");
printf("3+1= \n");
scanf("%d",&d);
if(d==4)
printf("Right\n");
else
printf("Wrong\n");
}
void subtraction()
{
int a,b,c,d;
printf("3-3= \n");
scanf("%d",&a);
if(a==0)
printf("Right\n");
else
printf("Wrong\n");
printf("4-3= \n");
scanf("%d",&b);
if(b==1)
printf("Right\n");
else
printf("Wrong\n");
printf("6-2= \n");
scanf("%d",&c);
if(c==4)
printf("Right\n");
else
printf("Wrong\n");
printf("3-1= \n");
scanf("%d",&d);
if(d==2)
printf("Right\n");
else
printf("Wrong\n");
}
void looping(int choice)
{
if(choice==1)
{
addition();
}
else if(choice==2)
{
subtraction();
}
else
{
printf("You must select 1 or 2\n");
}
}