Я пытаюсь позволить программе прочитать итоговую сумму, которая была ранее введена после запроса ввода для переменной month. Итого всегда 28257, и я не знаю почему.
Я узнал, что " %c"
в строке 11 работает, но мне хотелось бы знать, почему "%s"
не работает.
#include <stdio.h>
int main(void) {
int total;
char month;
float sales;
printf ("Enter total amount collected (-1 to quit): ");
scanf("%d", &total);
printf("Enter name of month: ");
scanf("%s", &month);
printf("total collections : $ %d\n", total);
sales = (total/1.09);
printf("sales : $ %.2f\n", sales);
printf("county sales tax: $ %.2f\n", sales * 0.05);
printf("state tax: $ %.2f\n", sales*0.04);
printf("total sales tax collected: $ %.2f\n", sales *0.05 + sales *0.04);
return 0; }