I'm new to C so I'm having a bit of trouble with scanf().
#include <stdio.h>
#include <stdlib.h>
int main()
{
int height;
int weight;
printf("Enter height in inches:\n");
scanf("%d", &height);
printf("Enter weight in pounds:\n");
scanf("%d", &weight);
printf("You are %d inches tall and weigh %d pounds.", height, weight);
return 0;
}
I'm pretty sure this is the correct syntax but when I run it, it shows an empty screen and after I input 2 numbers it shows:
64
120
Enter height in inches:
Enter weight in pounds:
You are 64 inches tall and weigh 120 pounds.
According to some tutorials, it's supposed to display "Enter height in inches:" before I input the 1st number and "Enter weight in pounds:" before I input the 2nd number. Please help me!
I'm using Eclipse to write my programs and MinGW as the compiler if that's relevant.