Hi there. I'm pretty new to this - finding the tutorials easy to follow though!
So after tutorials 3 and 4 I had a crack at doing the stuff below. I managed to get it to work pretty much as intended. The only thing is, when I run it, the end message
[Process returned 0 (0x0) execution time ### Press any key to continue]
comes up before I've pressed enter, although I have the "getchar()" at the end.
If I put a second one in, it does it, or anywhere else in the code, but it doesn't seem to happen there....
Is it something to do with the switch?


Code:
#include <stdio.h>

int mult (int x, int y)
{return x*y;}
int add (int x, int y)
{return x+y;}
int take (int x, int y)
{return x-y;}

int main()
{
    int x;
    int y;
    int input;
    printf("Please input two numbers. \nPut a space between them. ");
    scanf("%d", &x);
    scanf("%d", &y);
    printf("What would you like to do with these numbers? \n");
    printf("1. Multiply \n");
    printf("2. Add \n");
    printf("3. Take \n");
    scanf( "%d", &input);
    switch (input) {
        case 1:
        printf("= %d\n", mult(x,y));
        break;
        case 2:
        printf("= %d\n", add(x,y));
        break;
        case 3:
        printf("= %d\n", take(x,y));
        break;
        default:
        printf("That wasn't an option!\n ");
    }
    getchar();
    return 0;
}