-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloop1.cpp
73 lines (37 loc) · 763 Bytes
/
loop1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include<iostream>
using namespace std;
int main(){
// printing rohit army ten times
// for(int count=1;count<=10;count=count+1){
// cout<<"rohit army"<<endl;
// }
// printing hello 10 times
// for(int i=0;i<=10;i++){
// cout<<"hello"<<endl;
// }
// printing numbers from 1 to n
// int n;
// cout<<"enter your number "<<endl;
// cin>>n;
// for(int count=1;count<=n;count=count+1){
// cout<<count<<endl;
// }
// printing squares from 1 to n
// int n;
// cout<<"enter your value of n"<<endl;
// cin>>n;
// for(int i=1;i<=n;i=i+1){
// cout<<i*i<<endl;
// }
int num;
cout<<"enter the number"<<endl;
cin>>num;
for(int i=1;i<=num;i=i+2 ){
if(i%2!=0){
cout<<i<<endl;
}
else{
}
}
return 0;
}