We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 602dd85 commit 1c7329fCopy full SHA for 1c7329f
1 file changed
Natural Numbers Sequence/natural_numbers.cpp
@@ -0,0 +1,21 @@
1
+#include <iostream>
2
+using namespace std;
3
+int main()
4
+{
5
+ int start, end;
6
+ cout << "Enter your starting number : " << endl;
7
+ cin >> start;
8
+ cout << "Enter your end number : " << endl;
9
+ cin >> end;
10
+ if (start <= 0 || end <= 0)
11
+ cout << "A Natural Number can't be negative, fractional or equal to zero.." << endl;
12
+ else if (end < start)
13
+ cout << "End Number should be larger than starting number" << endl;
14
+ else
15
+ {
16
+ for (int i = start; i <= end; i++)
17
18
+ cout << i << " ";
19
+ }
20
21
+}
0 commit comments