-
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
1 parent
8569fe5
commit 2e1e9e1
Showing
21 changed files
with
348 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
language = "bash" | ||
run = "" |
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,7 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
cout<<"Hello World"<<endl; | ||
return 0; | ||
} |
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,16 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char a; | ||
cin>>a; | ||
if( a=='a' || a=='e' || a=='i' || a=='o' || a=='u'|| a=='A' || a=='E' || a=='O' || a=='U' || a=='I' ) | ||
{ | ||
cout<<"Vowel"<<endl; | ||
} | ||
else | ||
{ | ||
cout<<"Consonant"<<endl; | ||
} | ||
return 0; | ||
} |
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 a,b,c; | ||
cin>>a>>b>>c; | ||
if(a>b && a>c) | ||
{ | ||
cout<<"a is greator"<<endl; | ||
} | ||
else if(b>a && b>c) | ||
{ | ||
cout<<"b is greator"<<endl; | ||
} | ||
else | ||
{ | ||
cout<<"c is greator"<<endl; | ||
} | ||
return 0; | ||
} |
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,29 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
using namespace std; | ||
int main() { | ||
float a, b, c, x1, x2, discriminant, realPart, imaginaryPart; | ||
cout << "Enter coefficients a, b and c: "; | ||
cin >> a >> b >> c; | ||
discriminant = b*b - 4*a*c; | ||
if (discriminant > 0) { | ||
x1 = (-b + sqrt(discriminant)) / (2*a); | ||
x2 = (-b - sqrt(discriminant)) / (2*a); | ||
cout << "Roots are real and different." << endl; | ||
cout << "x1 = " << x1 << endl; | ||
cout << "x2 = " << x2 << endl; | ||
} | ||
else if (discriminant == 0) { | ||
cout << "Roots are real and same." << endl; | ||
x1 = -b/(2*a); | ||
cout << "x1 = x2 =" << x1 << endl; | ||
} | ||
else { | ||
realPart = -b/(2*a); | ||
imaginaryPart =sqrt(-discriminant)/(2*a); | ||
cout << "Roots are complex and different." << endl; | ||
cout << "x1 = " << realPart << "+" << imaginaryPart << "i" << endl; | ||
cout << "x2 = " << realPart << "-" << imaginaryPart << "i" << endl; | ||
} | ||
return 0; | ||
} |
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; | ||
int main() | ||
{ | ||
int year; | ||
cin>>year; | ||
if(year%4==0) | ||
{ | ||
if(year%100==0 and year%400==0) | ||
{ | ||
cout<<"Leap year"<<endl; | ||
} | ||
else | ||
{ | ||
cout<<"Not a leap year"<<endl; | ||
} | ||
} | ||
return 0; | ||
} |
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,14 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a; | ||
cin>>a; | ||
int sum=0; | ||
for(int i=0;i<=a;i++) | ||
{ | ||
sum=sum+i; | ||
} | ||
cout<<"Sum is: "<<sum<<endl; | ||
return 0; | ||
} |
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,14 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a; | ||
cin>>a; | ||
int fact=1; | ||
for(int i=1;i<=a;i++) | ||
{ | ||
fact=fact*i; | ||
} | ||
cout<<"fact is: "<<fact<<endl; | ||
return 0; | ||
} |
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,12 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a; | ||
cin>>a; | ||
for(int i=1;i<=10;i++) | ||
{ | ||
cout<<a<<"*"<<i<<"="<<a*i<<endl; | ||
} | ||
return 0; | ||
} |
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 a=0,b=1,temp; | ||
int c,d; | ||
cin>>c; | ||
cout<<a<<","<<b<<","; | ||
for(int i=1;i<c;i++) | ||
{ | ||
d=a+b; | ||
a=b; | ||
b=d; | ||
cout<<d<<","; | ||
} | ||
return 0; | ||
} |
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 a=0,b=1,temp; | ||
int c,d; | ||
cin>>c; | ||
cout<<a<<","<<b<<","; | ||
for(int i=1;i<=c;i++) | ||
{ | ||
if(d<=c) | ||
{ | ||
cout<<d<<","; | ||
d=a+b; | ||
a=b; | ||
b=d; | ||
} | ||
} | ||
return 0; | ||
} |
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<algorithm> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a,b,hcf=0; | ||
cin>>a>>b; | ||
int c=max(a,b); | ||
for(int i=1;i<=c;i++) | ||
{ | ||
if(a%i==0 && b%i==0) | ||
{ | ||
hcf=i; | ||
} | ||
} | ||
cout<<hcf; | ||
return 0; | ||
} |
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,10 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a; | ||
cout<<"Enter a integer: "; | ||
cin>>a; | ||
cout<<a<<endl; | ||
return 0; | ||
} |
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,55 @@ | ||
#include<iostream> | ||
#include<algorithm> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a,b; | ||
int l[100],m[100]; | ||
cin>>a>>b; | ||
int p,q; | ||
int c=max(a,b); | ||
for(int i=1;i<=c;i++) | ||
{ | ||
p=a*i; | ||
l[i]=p; | ||
|
||
} | ||
for(int i=1;i<=c;i++) | ||
{ | ||
q=b*i; | ||
m[i]=q; | ||
} | ||
for(int i=1;i<=c;i++) | ||
{ | ||
for(int j=1;j<=c;j++) | ||
{ | ||
if(l[i]==m[j]) | ||
{ | ||
cout<<l[i]; | ||
} | ||
} | ||
} | ||
return 0; | ||
} | ||
/* #include <iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int n1, n2, max; | ||
cout << "Enter two numbers: "; | ||
cin >> n1 >> n2; | ||
// maximum value between n1 and n2 is stored in max | ||
max = (n1 > n2) ? n1 : n2; | ||
do | ||
{ | ||
if (max % n1 == 0 && max % n2 == 0) | ||
{ | ||
cout << "LCM = " << max; | ||
break; | ||
} | ||
else | ||
++max; | ||
} while (true); | ||
return 0; | ||
} | ||
*/ |
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,12 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a,b; | ||
cout<<"Enter first integer: "; | ||
cin>>a; | ||
cout<<"Enter second integer: "; | ||
cin>>b; | ||
cout<<"Sum is: "<<a+b<<endl; | ||
return 0; | ||
} |
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,13 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
int divisor,dividend; | ||
cout<<"Enter divisor: "; | ||
cin>>divisor; | ||
cout<<"Enter dividend: "; | ||
cin>>dividend; | ||
cout<<"Remainder is: "<<int(divisor%dividend)<<endl; | ||
cout<<"Quotient is: "<<int(divisor/dividend)<<endl; | ||
return 0; | ||
} |
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,10 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
cout<<"Size of int is: "<<sizeof(int)<<endl; | ||
cout<<"Size of float is: "<<sizeof(float)<<endl; | ||
cout<<"Size of double is: "<<sizeof(double)<<endl; | ||
cout<<"Size of char is: "<<sizeof(char)<<endl; | ||
return 0; | ||
} |
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 <bits/stdc++.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a,b,temp; | ||
cin>>a>>b; | ||
swap(a,b); | ||
cout<<a<<" "<<b<<endl; | ||
/* | ||
temp=a; | ||
a=b; | ||
b=temp; | ||
cout<<a<<" "<<b; */ | ||
return 0; | ||
} |
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,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char a; | ||
cin>>a; | ||
cout<<"ASCII value is: "<<int(a)<<endl; | ||
return 0; | ||
} |
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,12 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
float a,b; | ||
double c; | ||
cin>>a>>b; | ||
c=a*b; | ||
cout<<"Multiplication is: "<<c<<endl; | ||
cout<<"Multiplication is: "<<a*b<<endl; | ||
return 0; | ||
} |
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> | ||
using namespace std; | ||
int main() | ||
{ | ||
int a; | ||
cin>>a; | ||
if(a & 1) | ||
{ | ||
cout<<"Odd"<<endl; | ||
} | ||
else | ||
{ | ||
cout<<"Even"<<endl; | ||
} | ||
if(a%2==0) | ||
{ | ||
cout<<"Even"<<endl; | ||
} | ||
else | ||
{ | ||
cout<<"Odd"<<endl; | ||
} | ||
return 0; | ||
} |