Code:
#include <stdio.h>
main ()
{
float user_number = 0, current_maximum = 0 ;
do {
printf ("Enter a number: ") ;
scanf ("%f", &user_number) ;
if (user_number > current_maximum)
current_maximum = user_number ;
[COLOR="Red"]//if (user_number <= 0 )[/COLOR]
} while (user_number > 0 ) ;
printf ("The largest number you printed was: %f", current_maximum) ;
return 0 ;
}
Try this. I commented out the offending line. You didn't have a semicolon at the end of the statement.
EDIT: I think you need to review how while and do-while loops work. A while loop is a pretest loop which means it tests for some condition prior to running. If that condition evaluates to true, the loop runs and then checks the condition again prior to running again. If the condition evaluates to false, the loop does not run and the program continues to the next line after the loop.
while (condition)
{
//statements
}
A do-while loop is a posttest loop which means it tests for some condition after the loop has run at least once. If that condition evaluates to true, the loop runs again and then checks the condition. If the condition evaluates to false, the loop does not run and the program continues to the next line after the loop.
do
{
//statements
} while (condition)