If's are compare statements, they are not loops. For, do while, while, are examples of loops. It's very correct to indent nested if loops. but each part of each loop, needs to be indented also:
Code:
if( i < 10)
{
//this part get's indented 3 spaces (2 to 4 is OK, though)
if( c != '0' )
{
//this part is indented, *again*. Now we're at 6 spaces indentation
}
else
printf("%c", line[i]); //etc.
//now we're back to 3 spaces
} //now back to the same column that the opening brace for the larger if is on.
Before long, your eyes will just automatically start looking for matching braces. Having them line up on the same column of the page when they match, is a big help.
Given your job, here, I would use either a do while, a while, or a for loop, to get it done. No if statements needed. The tests that are needed, would be done right inside the loop, itself:
Code:
//seeing that i < 10 is part of the "given" info, and that fantastic has 9 letters, I might
use a for loop, like this:
for(i = 0; i < 10; i++)
printf"%c", line[i]);
Usually, when I don't know how long the string will be, I'd use a while loop:
Code:
i = 0; //this is called "priming the pump", and is usually needed for while & do while loops
while( line[i] ) //will exit when the end of string char is reached
printf("%c", line[i++]);
Actually, you have all the char's you need in line[]. You don't need the variable c, at all.
Just line[] and a counter, like i.