#include "stdafx.h" #include<iostream> #include<string> using namespace std; int main() { unsigned int userInput; unsigned long long factorial = 1; string sum = "0"; cout << "Enter an integer: "; cin >> userInput; for (int i = 1; i <= userInput; ++i) { factorial *= i; std::string intCast = std::to_string(i); sum = sum + "*" + intCast; } sum.replace(0, 2, "");//if you don't want to see 0+ cout << "\nFactorial of " << sum << "=" << factorial; cin.get(); cin.get(); return 0; }