Professional Documents
Culture Documents
Lab
Lecture 5
do
{
statements ;
}
while ( condition ) ;
int main()
{
int n =1;
do
{
cout<<“Number is”<<n<<endl;
n++;
}
While(n<=10)
return 0;
}
Prepared by Aqsa Gul, Lecturer Institute of Management Sciences Peshawar
Task
Write a program using do-while loop and print the sum of series given below
1 + ½ + 1/3 + ¼ + 1/5+ …. 1/45
Write a program to print even numbers between 1-40 using do-while loop.
Write a program to print the output shown below using do-while loop.
11
12
13
21
22
23
31
32
33
Write a nested while loop program and display the loop execution cycle number.
*
* *
* * *
* * * *