C Basics
Marathon Calorie Calculator
Calculate calories burned by a marathon runner based on distance travelled.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Calculate calories burned by a marathon runner based on distance travelled.
| Input | Distance in metres: 7500 |
| Expected Output | You burned 375 calories by running 7.5km |
#include <stdio.h>
int main() {
float distance;
printf("Enter the distance you travelled in metres: ");
scanf("%f", &distance);
float kmdistance = distance / 1000;
float calorieburn = kmdistance * 50;
printf("You burned %.0f calories by running %.1fkm.\n", calorieburn, kmdistance);
return 0;
}
Enter the distance you travelled in metres: 7500
You burned 375 calories by running 7.5km.