So I am doing C++ course, and Mosh made an answer with answer and not equation for the factorial exercise, how can I implement answer to in this program with only few changes?
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int factorial;
cout << "Number(Positive Please): ";
cin >> factorial;
if (factorial < 0)
cout << "Not Positive! ";
if (factorial == 0) cout << 1;
else {
for (int i = factorial; i > 0; i--){
cout << i;
if (i == 1)
cout << endl << "Done";
else
cout << " * ";
}
}
return 0;
}