C PLEASE THANK YOU PART A PART B C AS WELL For each of the
C++ PLEASE THANK YOU:
PART A:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PART B: C++ AS WELL
For each of the given program segments, read the code and write the output in the space provided below each program. [Note: Do not execute these programs on a computer.l 29. What is output by the following program segment? I int X 1; 3 while C x 5 X++ 6 Cout \"The value of x is x endl; 9 cout \"The final value of xis: x endl Your answer:Solution
29)
 val if x is2
 ans 3,4,5,6,6
 when x=5
 enters loop
 and x becomes 6
 and prints 6
 and outside loop it again pirnts 6
 
 
 32)
 output:
 2 4 6 8
 divisible by 2 only it prints .that is less than 10
 
 36)output:
 total=3,
 6
 9
 12
 15
 18
 finally 18;
 37)output;
 9
 when
 1 2 3 4 -1
 loop terminates only input is -1
 
 38)
 output ;8
 becaouse it is post inceremnt
 x++ becomes 4 and 4+4=8
 
 factorial of number
 #include <iostream>
 using namespace std;
 int main() {
    unsigned int num;
 unsigned long long fact = 1;
 cout << \"positve integer : \";
 cin >> num;
 for(int j = 1; j <=num; ++j)
 {
 fact*= j;
 }
 cout << \"and finally factorial of number is \" << num << \" = \" << fact;
    return 0;
 }
 output:
 positve integer :5
 and finally factorial of number is 5 = 120
 
 #include <iostream>
 using namespace std;
 int main() {
    unsigned int num;
 unsigned long long fact = 1;
 int k=0;
 cout << \"positve integer : \";
 cin >> num;
 for(int j = 1; j <=num; ++j)
 {
 fact*= j;
 k+=j/fact;
 cout << \"and finally factorial of number is \" << num << \" = \" << k;
   
 }
 // cout << \"and finally factorial of number is \" << num << \" = \" << k;
    return 0;
 }
 


