neilofbodom
Member
Hi
I have just started learning C. I am currently using the Eclipse IDE and I started writing a program which gives the user the distance traveled depending on the speed and the time.
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int mph,time;
printf("Enter your speed in miles per hour: ");
scanf("%d",&mph);
printf("Enter your time: ");
scanf("%d",&time);
printf("Distance travelled is: %d", mph*time);
return 0;
}
I do not understand what the problem is. Eclipse is telling me that the program contains errors but I do not know what is wrong with it! Can anyone help??
Cheers
I have just started learning C. I am currently using the Eclipse IDE and I started writing a program which gives the user the distance traveled depending on the speed and the time.
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int mph,time;
printf("Enter your speed in miles per hour: ");
scanf("%d",&mph);
printf("Enter your time: ");
scanf("%d",&time);
printf("Distance travelled is: %d", mph*time);
return 0;
}
I do not understand what the problem is. Eclipse is telling me that the program contains errors but I do not know what is wrong with it! Can anyone help??
Cheers