okay, I want to output the even integers rom 2 to 100 and I will put my code on here (since everyone barks at me) what is wrong with it.
counter = 2;
Do {
if ( counter % 2 == 0 )
printf( "%d
", counter );
counter += 2;
} While ( counter < 100 );
I cant find the problem, thanks
Comments
: okay, I want to output the even integers rom 2 to 100 and I will put my code on here (since everyone barks at me)
[blue]everyone "barks" at you because we are not mind readers and misplaced our crystal balls. We can't help you if we know nothing about what you did.[/blue]
what is wrong with it.
:
[code]
: counter = 2;
:
: Do {
: if ( counter % 2 == 0 )
: printf( "%d
", counter );
:
: counter += 2;
: } While ( counter < 100 );
:
: I cant find the problem, thanks
:
[/code]
You didn't specify the proglem. Since you are incrementing the counter by 2 you don't need to use the mod operator because it will always be even numbers.
The only thing I see that is really wrong is that, if you want to also print the value 100, you need to change the while statement
[code]
{ while( counter [red]<= 100[/red]);
[/code]
: :
: [code]
: : counter = 2;
: :
: : Do {
: : if ( counter % 2 == 0 )
: : printf( "%d
", counter );
: :
: : counter += 2;
: : } While ( counter < 100 );
: :
: : I cant find the problem, thanks
: :
: [/code]
:
As someone replied in a previous post, keywords do not get capitalized.