fork download
  1. #include <iostream>
  2. int main()
  3. {
  4. std::cout << "Enter the natural number ";
  5. int m;
  6.  
  7. if (!(std::cin >> m)) {
  8. std::cout << "Invalid entry\n";
  9. } else {
  10. for (int i = 1; i < m; i++) {
  11. for (int j = 1; j < i; j++) {
  12. int rem = i + j;
  13. std::cout << rem << '\n';
  14. }
  15. }
  16. }
  17. }
Success #stdin #stdout 0s 3144KB
stdin
Standard input is empty
stdout
Enter the natural number Invalid entry