trying to reverse inputted number then do operation depending on choice of menu and display!
#include<stdio.h>
#include<ctype.h>
int main(void)
{
int digval, revdigval, answer;
char a, b, c, d, e, menu;
puts(" Please input a value with 5 numbers or less\n ");
scanf("%i", &digval);
printf("Value is %i\n", digval);
do
{
printf("Menu\n A.) Add reverse\n B.) Subtract reverse\n C.) Multiply reverse\n D.) Divide reverse\n");
scanf(" %c",&menu);
switch(toupper(menu))
{
case 'A': do {
revdigval=digval%10;
printf("%d",revdigval);
digval = digval/10;
answer= digval+revdigval;
printf("%i\n", answer);
} while(digval>0);
break;
case 'B':do
{
revdigval=digval%10;
printf("%d",revdigval);
digval = digval/10;
answer= digval-revdigval;
printf("%i\n", answer);
} while(digval>0);
break;
case 'C':
do
{
revdigval=digval%10;
printf("%d",revdigval);
digval = digval/10;
answer= digval*revdigval;
printf("%i\n", answer);
} while(digval>0);
break;
case 'D': do
{
revdigval=digval%10;
printf("%d",revdigval);
digval = digval/10;
answer= digval/revdigval;
printf("%i\n", answer);
} while(digval>0);
}
}
while(digval>0);
//do
//{
// b=a%10;
// printf("%d",b);
// a = a/10;
//}
//while(a>0);
getchar();
getchar();
return 0;
}