Skip to content

Commit 53856b9

Browse files
authored
Add files via upload
1 parent 50cb62e commit 53856b9

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

ForLoop.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
int n;
7+
cout << "Enter the no. ";
8+
9+
cin >> n;
10+
11+
/*
12+
for (int i = 1; i <= n; i++)
13+
{
14+
cout << i << endl;
15+
}
16+
*/
17+
18+
int i = 1;
19+
for (;;)
20+
{
21+
if (i <= n)
22+
{
23+
cout << i << endl;
24+
}
25+
else
26+
{
27+
break;
28+
}
29+
30+
i++;
31+
}
32+
33+
cout << endl;
34+
35+
for (int a = 0, b = 2; a < n && b < n; a++, b++)
36+
{
37+
cout << a << " " << b << endl;
38+
}
39+
40+
return 0;
41+
}

0 commit comments

Comments
 (0)