hi guys, I'm new to C language and am currently using an online tutorial, ive been doing prety well on my own until now.
Basicly the problem is with the "while" command, when i copy and paste the code im working with from the tutorial site into a word pad document and save and compile it, it works fine, however when i replicate it for training purposes i always get the same 2 compile errors saying the "while" command has no effect in the main() command.
Heres my codings.
#include <stdio.h>
main()
{
int below, number;
number = 0;
while( number<= 0 ); {
printf("type a number to come backwards\n");
scanf("%d", &number);
if( number <= 0 )
printf("number must be positive fool");
}
while( number != 0 );
{
below = number % 10;
printf("your number is now %d", below);
number = number / 10;
}
printf("\n");
}
and heres there coding with a link to the site at the bottom.
#include <stdio.h>
main()
{
int value, r_digit;
value = 0;
while( value <= 0 ) {
printf("Enter the number to be reversed.\n");
scanf("%d", &value);
if( value <= 0 )
printf("The number must be positive\n");
}
while( value != 0 )
{
r_digit = value % 10;
printf("%d", r_digit);
value = value / 10;
}
printf("\n");
}
http://gd.tuwien.ac.at/languages/c/programming-bbrown/c_023.htm
apart from the int names and text within printf argument everything else seems to be the same ( to me atleast )
any feedback would be a big help. thx.