Calculation

I have a problem with my final code the calculation is wrong and I do not know why this my code:
#include <stdio.h>

int main() {

int child1day = 92;

int adult1day = 108;

int child4day = 350;

int adult4day = 407;

double taxrate = 0.65;

float total;

int days;

printf("How many children tickets\n");

scanf("%d" ,&child1day);

printf("How many days are they staying ?\n");

scanf("%d", &days);

printf("How many adults tickets for the adult\n");

printf("How many days are you staying ?\n");

scanf("%d" ,&days);

printf("The total cost is \$%.2lf.\n", total*(1+taxrate));

return 0;

}

You are viewing a single comment. View All
mwilki7 (264)

Would you be able to give an example of correct output vs incorrect output?

Dave1 (1)

@mwilki7 a correct output will give right answer for the calculation a wrong one give a wrong answer

mwilki7 (264)

For example, I enter "1 1 1 1" in the program I get:

How many children tickets
1
How many days are they staying ?
1
How many adults tickets for the adult
1
How many days are you staying ?
1
The total cost is \$810.46.

Is \$810.46 the correct total?
If it is not the correct total, what should be the correct total for "1 1 1 1"?