0
#include <cs50.h>
#include<math.h>
#include<stdio.h>
int main(void)
{
    int n = 0;
    do
    {
        n = (get_float("Change owed: ") * 100);
    }
    while (n < 0);
    int q = ((n / 25) % 10);
            int d = ((q / 10) % 10);
                    int r = ((d / 5) % 10);
                            int c = (n % 10);
                                    int i = q + d + n + c;
                                            printf("%i, i");
}

It then yields this:

ErrorHelp50

7
  • printf("%i, i"); should be printf("%i", i);
    – stensal
    May 28, 2020 at 3:09
  • facepalm You see, I followed your tips, but one mishap leads to this. May 28, 2020 at 3:10
  • Unfortunately, the compiler is very unforgiving.
    – stensal
    May 28, 2020 at 3:16
  • So true. It's like a Terminator. (Excuse the pun. Computer science, get it?) May 28, 2020 at 3:29
  • 1
    You are suffering from the same malady that I had when I started in C (and still have to this day.) You're creating all kinds of syntax errors like missing semicolons, quotes in teh wrong places, incorrect structuring of loops, etc. Programming requires very exact syntax, not just close. Computers are very stupid, so it has to be exactly what they expect. They don't look at code and think "Oh, you mean't this, not that." So, when I code, I write my code, then I spend the next 20 minutes correcting all the typos I made that the compiler tells me about.
    – Cliff B
    May 28, 2020 at 3:42

0

You must log in to answer this question.

Browse other questions tagged .