Minutes to seconds
Convert a duration with one multiplication. An easy embedded C problem (First steps in C), run and graded in the browser.
easy · First steps in C · arithmetic
A timer is configured in seconds, but the user enters minutes.
Return the number of seconds in minutes minutes.
Starter code
int to_seconds(int minutes) {
return 0;
}Example tests
One minute
printf("%d\n", to_seconds(1));Expected output:
60Five minutes
printf("%d\n", to_seconds(5));Expected output:
300Learn it first
- Microcontrollers and your first program · What a microcontroller is, how code gets onto it, and the parts of a C program.
More First steps in C problems
- Return a value · Make a function hand back a number.
- Add two numbers · Use the inputs a function receives.
- Fix a compiler error · Read an error message and repair the code.
- Area of a rectangle · Combine two parameters into one result.
- Print a line · Send text to the output with printf.
- Print a number · Put a value into printed text with a placeholder.