Total members 11894 |It is currently Thu Nov 21, 2024 5:12 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Code:

int x
=5

do{

      print(
"%d\n",x);
      
x--;
}while(
x>=1)
 





Code:

int m
=0i;
for(
i=1;i<=7;i+=3){
     
m=m+i;
     print(
"m=%d\n",m);






Author:
Newbie
User avatar Posts: 6
Have thanks: 0 time

For code snippet :do-while loop prints :
5
4
3
2
1

Second example prints :
1
4
11

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

For this message the author DrRakha has received gratitude : sakorian

lol Shouldn't give him the answers looks like homework to me should give him tips. Pretty close to the same questions i had on my last weeks programming homework.


Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time
Post new topic Reply to topic  [ 3 posts ] 

  Related Posts  to : do while loop and for loop C++ example help.
 While loop     -  
 C++ While loop     -  
 Do while loop     -  
 I NEED SOME HELP IN THE FOR LOOP PLZ .. IAM JUST A BEGINNER     -  
 Using include() Within a Loop     -  
 Why will my loop does not work     -  
 Breaking a Loop     -  
 PIC Assembly For Loop Example     -  
 Counting Backwards Loop     -  
 for statement loop indefinitely     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com