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 & 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; }
7 Réponses
+ 4
use scanf to get user input.
input should be an integer.
store it in "tickets" variable.
+ 3
The answer is:
use
scanf()
https://www.w3schools.com/c/c_user_input.php
+ 1
re-read the lesson. It means you've not learned it yet.
0
I didn't get it , May u write me the answer
0
use scan(f)
0
Use Scang for input from user
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.