Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 5.13 Deitel & Deitel C++ How to Program, 10th ed (Indian subcontinent adaptation)
- Visual Studio Community 2019 */
- #include <iostream>
- #include <iomanip>
- #include <limits>
- using namespace std;
- int main(void) {
- long long factorial{ 1 };
- cout << "\n" << setw(5) << "n" << setw(22) << "n!";
- for (int n{ 1 }; n <= 20; n++) {
- factorial *= n;
- cout << "\n" << setw(5) << n << setw(22) << factorial;
- if (factorial > 2147483647) cout << " (long int breaks at " << LONG_MAX << " + 1)";
- }
- cout << "\n\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment