Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ PLEASE THANK YOU: PART A: --------------------------------------------------

ID: 3788969 • Letter: C

Question

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:

Explanation / Answer

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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote