Can't get the \n (e.g., "What's the price?\n" ) to space my $ one line below output, albeit using lecture code. Anyone knows what might be the problem. Regards

#include <cs50.h>
#include <stdio.h>

int main(void)
    float price = get_float("What's the price?\n");

    printf("Your total is %f", price*1.065);

Terminal Code

$ make float

clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -
std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -
Wno-unused-variable -Wshadow    float.c  -lcrypt -lcs50 -lm -o float

$ ./float

What's the price?


Your total is 1314.210000$

  • Maybe you should use a new line in the printf function: printf("Your total is %f\n", price*1.065); – MARS Aug 29 '20 at 8:38

You must log in to answer this question.

Browse other questions tagged .