0

Who has the solution ?

We need to change it, to take the number of tickets ordered from input. The price should remain declared with the given value. (Remember to use the correct format specifier when taking input, and use the &amp; symbol before the variable name in the scanf() function.) #include <stdio.h> int main() { // number of tickets ordered int tickets; // take it from input // price per ticket float price = 7.45; float total = tickets*price; printf("Total: %f", total); return 0; }

24th Jun 2024, 9:36 AM
Serwan Ato
Serwan Ato - avatar
7 Respuestas
+ 4
use scanf to get user input. input should be an integer. store it in "tickets" variable.
24th Jun 2024, 9:54 AM
Lisa
Lisa - avatar
+ 3
24th Jun 2024, 10:08 AM
Lisa
Lisa - avatar
+ 1
re-read the lesson. It means you've not learned it yet.
24th Jun 2024, 1:00 PM
Bob_Li
Bob_Li - avatar
0
I didn't get it , May u write me the answer
24th Jun 2024, 10:02 AM
Serwan Ato
Serwan Ato - avatar
0
use scan(f)
24th Jun 2024, 3:27 PM
Zachary Ydunate
Zachary Ydunate - avatar
0
Use Scang for input from user
25th Jun 2024, 3:04 PM
Er Jawwad
Er Jawwad - avatar
0
Personally I would do: #include <stdio.h> int main() { int tickets; scanf("%d", &tickets); printf("Total: $%.2f\n", tickets * 7.45); return 0; } It’s concise, has precision handling, directly calculates with the ‘printf’ statement to maximize execution speed, and minimizes I/O operations. What more can you want xaxa.
26th Jun 2024, 4:22 AM
X—X
X—X - avatar