Switch to full style
For C/C++ coders discussions and solutions
Post a reply

C++ for loops

Fri Apr 08, 2011 2:29 am

How do I write a for loop from 200 to 100, decremented by 4? So far I have: for (int n=200; n>99; ???????



Re: C++ for loops

Fri Apr 08, 2011 10:46 am

code help ,
Code:
for(int i=200,i>100;i--)
{
/// do your work here. 
}
 


or
decrease by 4
Code:


for(int i=200,i>100;i-=4)
{
/// do your work here. 
}
 


Post a reply
  Related Posts  to : C++ for loops
 C++ For Loops     -  
 Nesting Two for Loops     -  
 Loops and Branching     -  
 Break in Nested Loops     -  
 Re: Lets Learn C++----->(Lesson 4) Loops     -  
 write a while loops performing operations on number     -  
 Using Program Loops to Create Time Delays     -  

Topic Tags

C++ Loops