Kodewick
Start learning →
Starter←→0 / 70

A receipt line

#004StarterOutput2 min

The tea shop's receipt needs one line: how many cups and the total. cups is the number of cups and price is the price of one. Use printf to show 3 cups: 13.50: the cups with %d, and the total (cups times price) with %.2f for two decimal places.

Should show
3 cups: 13.50
main.c
#include <stdio.h>

int main(void) {
    int cups = 3;
    double price = 4.5;
    // your code here: printf the cups and the total, then a newline
    return 0;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.