Assignment Factorial and Power

Assignment: Factorial and Power

This assignment is to help you review C-programming for Numerical Programming.

Do NOT use Chat-GPT and online materials.

You can do it all by yourself !!


Problem

Q1. Create power(x,N) function that returns

y=xNy=x^N
double power(double x, int N);

Q2. Create factorial(x) function that returns

y=x!=x(x1)(x2)...1y=x! = x(x - 1)(x - 2)...1

Hint

image


Preparation

You must complete the following tutorials first.

Procedure

  1. Create a new project “ Assignment_powerNfactorial” with Visual Studio Community.

    It should be under the designated folder of \NP\assignment\

    ...\source\repos\NP\assignment\Assignment_powerNfactorial\

  2. Create a new source file

  1. Fill in the definitions of power() and factorial()

  1. Run the code and validate the answers

  1. Capture the output window and paste in the report

Submit

Submit as “Assignment_powerNfactorial_yourName.zip” that includes

1) Source code

  • submit only “Assignment_powerNfactorial_yourName.cpp”

2) Report: “Assignment_powerNfactorial_yourName.pdf”


Code

Last updated

Was this helpful?