First off, edit your post and put [ CODE ] [ /CODE ] tags in. Do it now.
Second, I'll offer some help. In the first code snippet
Code:
int main()
{
unsigned int i=10;
while(i>=0)
{
printf("%u",i)
i--;
}
return 0;
}
//Edited for clarity
Your missing something in the while loop. If you throw this in a compiler, it won't compile.
In the second code snippet, you are suffering from a very very common typo.
Code:
for (i=0;i=10;i+=2)
printf("Hi\\n");
Look closely at the condition for the for loop...
And just for the record, a very safe coding practice that you should get in the habit of doing is to use the following in your conditionals...
Code:
int main()
{
int i = 10;
if (10 == i)
{
//this is the safe way. If you forget a =, the compiler will tell you
}
while (i == 10)
{
//If you forget an =, then i will be set to 10, and since all non 0 values are TRUE, the loop goes on forever!
}
return 0;
}
PK