Quiz: A Decimal Result

Seven euros split between two people is 3.50 each, but this program prints 3.00. Click the line with the mistake.

#include <stdio.h>

int main(void) {
    int bill = 7;
    int people = 2;

    double each = bill / people;
    printf("Each pays: %.2f EUR\n", each);
    return 0;
}

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

10/13