MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / main1

Function main1

Lab_03/mn.cpp:7–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <iostream>
6using namespace std;
7int main1() {
8 int m, n, sum = 0;
9 cout << "Enter the 1st number: ";
10 cin >> n;
11 cout << "Enter the 2nd number: ";
12 cin >> m;
13 if (n < m) {
14 for (int x = n; x <= m; x++) {
15 sum += x;
16 }
17 cout << "The sum of the integers between the two numbers is " << sum << ";" << endl;
18 }
19 else if (m < n)
20 cout << "Invalid numbers! Please try again." << endl;
21 else if (m == n) {
22 sum = n;
23 cout << "The sum is " << sum << endl;
24 }
25 system("pause");
26 return 0;
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected