So...what/where is the method you've tried? Without providing you the answer...here is a basic outline:
using namespace std;
int num;//number to get it's factorial
cout << "Please enter a positive number: ";
cin >> num;//user enters number
if (num < 0)
cout << "That is not a positive number.\n";
cout << num << " factorial is: " << factorial(num) << endl;
The above isn't complete nor tested. Also, in the future, before posting, search the forums to see if someone else had the same problem/assignment. We are willing to help, but we don't want to waste time doing the same thing over and over again...In the factorial function, you could try something like this:
int factorial(int )
if(num <= 1) return 1;
//figure out the simple calculaltion
}//end for factorial
ok ok...totally missed that one...i didn't see another thread started by jbstin...the title of the threads were different...so i just went right in...my eyes need tested anyways...and AD...i'm not in kindergarden yet...so i can't read too well.
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...