The problem is that when I enter the choice, nothing happens and the answer remains 0. Please help I'm new at this and I tried everything!!
Thanks
#include <stdio.h>
#include <conio.h>
main ()
{
int a,b;
float answer;
char choice;
clrscr();
printf ("\nEnter a number: ");
scanf ("%d",&a);
printf ("\nEnter another number: ");
scanf ("%d",&b);
printf ("\n");
gotoxy(10,5);
printf("\n MENU");
printf("\n+...addition");
printf("\n*...multiplication");
printf("\n/...division");
printf("\nM...modulo division");
printf("\n");
printf("\nEnter your choice");
//scanf("%c",&choice);
choice = getch();
switch(choice)
{case'+' :{
answer = (a + b);
break;
}
case'*' :{
answer = (a * b);
break;
}
case'/' :{
answer = (a / b);
break;
}
case'M' :{
answer = (a % b);
break;
}
default : break;
}
printf("\n");
printf("\nThe answer is ");
printf("%d",answer);
getch();
}