I have a slight difficulty finding the most efficient way to represent 6! "factorial of six", here is my feeble attempt to come up with a code, please hand me some ideas, I'd appreciate it:
#include "stdafx.h"
#include <iomanip>
#include <iostream>
#include <math.h>
usingnamespace std;
int main()
{
int i = 1;
int j = 1 + i++;
int k = 1 + i++;
int l = 1 + i++;
int n = 1 + i++;
int m = 1 + i++;
int q = 1;
int p = 1 * j*k*l*n*m;
cout << q<<setw(5)<< j<< setw(5)<<k<< setw(5)<< l<< setw(5)<<n<< setw(5)<<setw(5)<<m<<setw(5)<< endl;
cout << "The factorial 6! is equal to "<< setw(2)<<p << endl;
system("pause");
return 0;
}
I'm still not familiar with the "for" operator and it did appear silly to me too done the hard way. I'll start serious reading and tasking to get myself into more efficient coding;