NO

Author Topic: Please help i get errors 2001 and 2157 when i run the program  (Read 3346 times)

ljeevara

  • Guest
Please help i get errors 2001 and 2157 when i run the program
« on: October 07, 2009, 01:26:25 PM »
if (h < 320);
{
printf("\nThe entered value is too low causing the satellite to slow down and burn up");
printf("\n\nRe-enter a value greater than 320:");
scanf("%f", &h_REDO);
printf("\nVc: %.2fkm/s",REDO);
}
else
printf("\nVc: %.2fkm/s",Vc);


I get errors for this part of program:
C:\Users\LOGAN\Documents\Pelles C Projects\Assignment1\Assignment1.c(32): error #2157: Unrecognized statement.
C:\Users\LOGAN\Documents\Pelles C Projects\Assignment1\Assignment1.c(33): error #2001: Syntax error: expected ';' but found 'printf'.


Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Please help i get errors 2001 and 2157 when i run the program
« Reply #1 on: October 07, 2009, 01:43:36 PM »
Remove the semicolon from the if line.

You may need to check the correct syntax of the commands, not all lines need a terminating semicolon.

In addition the build in source code formatter can help you identify such problems too.
« Last Edit: October 07, 2009, 02:28:23 PM by Stefan Pendl »
---
Stefan

Proud member of the UltraDefrag Development Team