Back to Computers & Modding

While loop error/national debt to gdp percentage calculator

vivoOP
#1
 char GDP1[30];
  int GDP;
  char natdebt1[30];
  int natdebt;
  float dpg; /* debt percentage of gdp */
  float counter;
  printf("Please enter the GDP of the country this company is located in.\n");
  gets(GDP1);
  GDP=atoi (GDP1);
  printf("Please enter the National Debt for the country this company is located in.      (Please include unfunded liabilities in addition to the budget deficit) \n");
  gets(natdebt1);
  natdebt=atoi(natdebt1);
  counter=0.01;
  while(dpg=GDP*0.01; dpg<natdebt; dpg++)
  {
    counter=counter++;
  };
  printf("Debt to GDP is %f percent. \n",counter);
I have been trying to find a way to have a decimal percentage of the national debt (of any country, but I am using the US debt to) and start at one percent of GDP and work up to the national debt (Including unfunded liabilities). But I ran across this
C:\QPCCaluclator\original2.c|80|error: expected ')' before ';' token| . I have tried everything, but it won't work. Thanks,
vivo.
Jonez001
#2
Wow, this isn't Java isn't it?
vivoOP
#3
haha, not
Jonez001
#4
Damn, I wish it was! Then i could help you
vivoOP
#5
Well, code you type anything in pseudo-code maybe?
Jonez001
#6
I don't have the time atm...
Loonylion
#7
at a guess, its your second printf line. those inner brackets probably need escaping.
vivoOP
#8
I found what was wrong. I was using the syntax of FOR in s WHILE statemtent. LOL sorry. Thanks for the help.
Showing posts 1–8 of 8 · This discussion is archivedBack to top