Skip to content

Commit c43f949

Browse files
Coding BlocksCoding Blocks
authored andcommitted
added section 01 code
1 parent b0adc1e commit c43f949

16 files changed

+297
-0
lines changed

.DS_Store

10 KB
Binary file not shown.

01 Getting Started with C++/.DS_Store

6 KB
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
//Question Von Neuman Loves Binary
5+
6+
7+
int main() {
8+
9+
int no;
10+
int N;
11+
cin>>N;
12+
13+
while(N>0){
14+
15+
cin>>no;
16+
17+
int p = 1;
18+
int ans = 0;
19+
20+
while(no>0){
21+
int r = no%10;
22+
ans = ans + r*p;
23+
p = p*2;
24+
no = no/10;
25+
}
26+
cout<<ans<<endl;
27+
N = N - 1;
28+
}
29+
30+
return 0;
31+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit b0adc1ea82d545fa7caa7e80576c6c148865d2e5
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
5+
int main(){
6+
// You are given N, followed by list of N numbers
7+
// Output : the squares of N Numbers
8+
/*
9+
10+
Input File
11+
3 N
12+
1
13+
2 No
14+
5
15+
16+
Output File
17+
1
18+
4 Ans
19+
25
20+
*/
21+
int N;
22+
cin>>N;
23+
24+
int no;
25+
while(N>0){
26+
cin>>no;
27+
cout<<no*no<<endl;
28+
29+
N = N - 1;
30+
}
31+
return 0;
32+
}

01 Getting Started with C++/hello.cpp

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include<iostream> //header file
2+
using namespace std; // standard c++ namespace
3+
4+
5+
6+
int main(){ //start
7+
8+
//Output
9+
cout<<"Hello Everyone!"<<endl;
10+
11+
return 0; //exit
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3
2+
1
3+
12
4+
5
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1
2+
144
3+
25
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
5+
int main () {
6+
7+
int n ;
8+
cin>>n;
9+
10+
int row = 1;
11+
while(row<=n){
12+
int col = 1;
13+
14+
if(row%2!=0){
15+
//Odd Row
16+
while(col<=row){
17+
cout<<1;
18+
col = col + 1;
19+
}
20+
21+
}
22+
else{
23+
//Even Row
24+
cout<<1;
25+
while(col<=row-2){
26+
cout<<0;
27+
col = col + 1;
28+
}
29+
cout<<1;
30+
}
31+
cout<<endl;
32+
row = row + 1;
33+
}
34+
35+
return 0;
36+
}

0 commit comments

Comments
 (0)