| 17 | } // end function qwerty |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | double n; |
| 22 | double sum = 0; |
| 23 | double fact = 1; |
| 24 | cout << "Please ebter the number: "; // outputing and inputing the number |
| 25 | cin >> n; |
| 26 | if (n > 0) // the program will calculate the sum when numbers is positive |
| 27 | cout << "Sum is: " << qwerty(n, sum, fact) << endl; // calling the function qwerty |
| 28 | else // when the number is negative 'else' will work |
| 29 | cout << "INVALID INPUT!" << endl; |
| 30 | system("pause"); |
| 31 | return 0; |
| 32 | } // ending the program successfully |