I trying to create something where the user has to give certain numbers and at the end the program prints all the numbers with a space in between.
Everything is working, except the last printf()
. I have tried to fflush
in and out like the previous scanf()
but nothing works.
Any suggestions? Here is the code:
printf("Give a round number:\n");
fflush(stdout);
scanf("%d", &roundNumber);
fflush(stdin);
printf("Give a decimal number:\n");
fflush(stdout);
scanf("%lf", &decimalNumber);
fflush(stdin);
printf("Give 2 round numbers separated by a ',' :\n");
fflush(stdout);
scanf("%d,%d",firstRoundNumber,secondRoundNumber);
fflush(stdin);
printf("Your numbers: %d %lf %d %d\n", roundNumber, decimalNumber, firstRoundNumber, secondRoundNumber);