Pelles C forum

C language => Beginner questions => Topic started by: ljeevara on October 07, 2009, 01:26:25 PM

Title: Please help i get errors 2001 and 2157 when i run the program
Post by: ljeevara 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'.

Title: Re: Please help i get errors 2001 and 2157 when i run the program
Post by: Stefan Pendl 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.