Please give me a brief explanationI am having a hard time wi
Please give me a brief explanation.I am having a hard time with this.
Show the output produced by each code segment. LOOPS//loop1 int a, b, c; a = 1;b = 9; c = 3 * b/5; while (c>= 1) {coutSolution
6.
Loop 1 :
int a,b,c;
 a=1,b=9; // The value of a is 1 and b is 9
 c=3*b/5; // c = 3*9/5 = 5
while(5>=1)
{
 cout<<c<<endl; // c=5
 c=c-1; // c=5-1=4
 a=a*2; // a= 1*2 = 2
 }
   
while(4>=1)
{
 cout<<c<<endl; // c=4
 c=c-1; // c=4-1=3
 a=a*2; // a= 2*2 = 4
 }
while(3>=1)
{
 cout<<c<<endl; // c=3
 c=c-1; // c=3-1=2
 a=a*2; // a= 4*2 = 8
 }
while(2>=1)
{
 cout<<c<<endl; // c=2
 c=c-1; // c=2-1=1
 a=a*2; // a= 8*2 = 16
 }
while(1>=1)
{
 cout<<c<<endl; // c=1
 c=c-1; // c=1-1=0
 a=a*2; // a= 16*2 = 32
 }
while(0>=1) // condition fail
Output :
5
4
3
2
1
32 9 0
Loop 2 :
int a,b;
a=1; // initially a value is 1
 cout<<\"Humor\" <<endl; // print Humor  
while(a<=4) // loop runs from a value 1 through 4
 {
 cout<<\"fun\";
 b=1; // initially b value is 1
 while(b<=3)   // loop runs from b value 1 through 3
 {
 cout<<\"Ha\"; // print Ha
 b++; // increment b value
 }
 cout<<endl;
 a++; // increment a value
 }
Output :
Humor
funHaHaHa
funHaHaHa
funHaHaHa
funHaHaHa


