-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pratiksha Shinde
committed
Oct 17, 2020
1 parent
e5b2154
commit dfa1713
Showing
33 changed files
with
358 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,78 @@ | ||
{ | ||
"files.associations": { | ||
"iostream": "cpp", | ||
"ostream": "cpp" | ||
"ostream": "cpp", | ||
"any": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"cfenv": "cpp", | ||
"charconv": "cpp", | ||
"chrono": "cpp", | ||
"cinttypes": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"codecvt": "cpp", | ||
"complex": "cpp", | ||
"condition_variable": "cpp", | ||
"csetjmp": "cpp", | ||
"csignal": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cuchar": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"deque": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"map": "cpp", | ||
"set": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"random": "cpp", | ||
"ratio": "cpp", | ||
"regex": "cpp", | ||
"string": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"future": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"iosfwd": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"scoped_allocator": "cpp", | ||
"shared_mutex": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"thread": "cpp", | ||
"typeindex": "cpp", | ||
"typeinfo": "cpp", | ||
"valarray": "cpp", | ||
"variant": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <string> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
string str, str2; | ||
int j = 0, sum =0, i=0; | ||
cin >> str; | ||
int len = str.length(); | ||
reverse(str.begin(), str.end()); | ||
while(j!=(len) && i!=len) { | ||
str2 = str[i]; | ||
stringstream convert(str2); | ||
int x; | ||
convert >> x; | ||
sum = sum + (x*pow(2,j)); | ||
j++; | ||
i++; | ||
} | ||
cout << sum; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int binary; | ||
cin >> binary; | ||
int i = 0, octal = 0, decimal = 0; | ||
while(binary!=0){ | ||
decimal = decimal + ((binary%10)*pow(2, i)); | ||
i++; | ||
binary = int(binary/10); | ||
} | ||
i = 1; | ||
while(decimal!=0){ | ||
octal = octal + ((decimal%8)*i); | ||
decimal = int(decimal/8); | ||
i = i*10; | ||
} | ||
cout << octal; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
float r, circumference; | ||
cin >> r; | ||
circumference = (2*3.14*r); | ||
cout << fixed << setprecision(2) << circumference; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int decimal; | ||
cin >> decimal; | ||
int i, octal = 0; | ||
i = 1; | ||
while(decimal!=0){ | ||
octal = octal + ((decimal%8)*i); | ||
decimal = int(decimal/8); | ||
i = i*10; | ||
} | ||
cout << octal; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int n, t1=0, t2=1, tn; | ||
cin >> n; | ||
for (int i=0; i<n; i++) { | ||
if(i==0) { | ||
tn = t1; | ||
} else if(i==1) { | ||
tn = t2; | ||
} else { | ||
tn = t1+t2; | ||
t1 = t2; | ||
t2 = tn; | ||
} | ||
cout << tn << " "; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int n1, n2, n3; | ||
cin >> n1; | ||
cin >> n2; | ||
cin >> n3; | ||
if(n1>=n2 && n1>=n3){ | ||
cout << n1; | ||
} else if(n2>=n1 && n2>=n3) { | ||
cout << n2; | ||
} else{ | ||
cout << n3; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int n, t1=0, t2=1, tn; | ||
cin >> n; | ||
for (int i=0; i<n; i++) { | ||
if(i==0) { | ||
tn = t1; | ||
} else if(i==1) { | ||
tn = t2; | ||
} else { | ||
tn = t1+t2; | ||
t1 = t2; | ||
t2 = tn; | ||
} | ||
} | ||
cout << tn << " "; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
bool palindrome(string str) { | ||
int len = str.length(); | ||
int mid = len/2; | ||
for (int i=0; i<mid; i++) | ||
for (int j=len; j>mid; j--) | ||
if(str[i]==str[j]) | ||
return true; | ||
return false; | ||
} | ||
|
||
int main() | ||
{ | ||
std::string str; | ||
std::getline(std::cin, str); | ||
palindrome(str) ? cout << "Palindrome" : cout << "Not a Palindrome"; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
bool palindrome(string str1, string str2) { | ||
if(str1 == str2) | ||
return true; | ||
return false; | ||
} | ||
|
||
int main() | ||
{ | ||
std::string str1, str2; | ||
std::getline(std::cin, str1); | ||
str2 = str1; | ||
reverse(str2.begin(), str2.end()); | ||
palindrome(str1, str2) ? cout << "Palindrome" : cout << "Not a Palindrome"; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int n, reverse = 0, remainder; | ||
cin >> n; | ||
while(n != 0) | ||
{ | ||
remainder = n % 10; | ||
reverse = (reverse*10) + remainder; | ||
n = n / 10; | ||
} | ||
cout << reverse; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
string str, str2; | ||
int i; | ||
cin >> str; | ||
int len = str.length(); | ||
reverse(str.begin(), str.end()); | ||
if(str[0]=='0'){ | ||
for(int j=1; j<=len; j++){ | ||
cout << str[j]; | ||
} | ||
} else { | ||
cout << str; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int a, b, c; | ||
float root1, root2, diff; | ||
cin >> a; | ||
cin >> b; | ||
cin >> c; | ||
diff = b*b-4*a*c; | ||
root1 = (-b+sqrt(diff))/(2*a); | ||
root2 = (-b-sqrt(diff))/(2*a); | ||
cout << "root1 = " << fixed << setprecision(2) << root1 << " " << "root2 = " << fixed << setprecision(2) << root2; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int n1, n2, n3; | ||
cin >> n1; | ||
cin >> n2; | ||
cin >> n3; | ||
if((n1>n2 && n1<n3) || (n1<n2 && n1>n3) || (n1==n2 && n1<n3)){ | ||
cout << n1; | ||
} else if((n2>n1 && n2<n3) || (n2<=n1 && n2>n3) || (n1==n3 && n1>n2)) { | ||
cout << n2; | ||
} | ||
else if(n1==n2 && n1>n3) { | ||
cout << n3; | ||
} | ||
else{ | ||
cout << n3; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
bool palindrome(string str1, string str2) { | ||
if(str1 == str2) | ||
return true; | ||
return false; | ||
} | ||
|
||
int main() | ||
{ | ||
std::string str1, str2; | ||
std::getline(std::cin, str1); | ||
str2 = str1; | ||
reverse(str2.begin(), str2.end()); | ||
palindrome(str1, str2) ? cout << str1 << " is a palindrome" : cout << str1 << " is not a palindrome"; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <iostream> | ||
#include <string> | ||
using namespace std; | ||
|
||
void reverse(string str) | ||
{ | ||
int len = str.length(); | ||
if(len==1) | ||
cout<<str; | ||
else | ||
{ | ||
cout << str[len-1]; | ||
reverse(str.substr(0, len - 1)); | ||
} | ||
} | ||
|
||
int main() | ||
{ | ||
string str; | ||
getline(cin, str); | ||
reverse(str); | ||
} |
Binary file not shown.