C++ do-While Loop

C++ do-While Loop , exit controlled loop, on some occasions, it might be necessary to execute the body of the loop before the test is performed,  such situations can be handle with the help of do-while statement.

In do while statements the body of the do-while loop is executed at least once.

 

do-while loop in c++

 

Example of C++ do-While Loop :-

#include<conio.h>
#include<iostream.h>
void main()
{
int a=1;
clrscr();
do{
cout<<“\t”<<a<<endl;
a++;
}
while(a<=10);
getch();
}

Result of C++ do-While Loop :-

do-while loop example

 

Example of while Loop in C++ 

 Write a program to print the table of a no. ?

   Write a program to print the Fibonacci series ?




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top