-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday6.cpp
More file actions
115 lines (103 loc) · 2.07 KB
/
day6.cpp
File metadata and controls
115 lines (103 loc) · 2.07 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
if(x==y){
cout<<"Both x and y are equal";
}
else if(x>y){
cout<<"x is greater than y";
}
else{
cout<<"y is greater than x";
}
return 0;
}
#include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
if(x==y){
cout<<"Both the numbers are equal";
}
else{
if(x>y){
cout<<"x is greater than y";
}
else{
cout<<"y is greater than y";
}
}
return 0;
}
// WAP to check if a no. is even or odd
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
if(n%2==0){
cout<<"even"<<endl;
}
else{
cout<<"odd"<<endl;
}
return 0;
}
//WAP to find maximum ,minimum among two nos.
#include<iostream>
using namespace std;
int main(){
int n1,n2;
cin>>n1>>n2;
int max,min;
if(n1>n2){
max=n1;
min=n2;
}
else {
max=n2;
min=n1;
}
cout<<"Max="<<max<<endl;
cout<<"Min="<<min<<endl;
return 0;
}
//WAP to check if a triangle is scalene, isosceles or equilateral
#include<iostream>
using namespace std;
int main(){
int sidea, sideb,sidec;
cout<<"input three sides of a triangle:\n";
cin>>side a>>side b>> side c;
if(sidea==sideb && sideb==sidec){
cout<<"this is an equilateral triangle.\n";
}
else if(sidea==sideb||sidea==sidec||sideb==sidec){
cout<<"this is a isosceles triangle.\n";
}
else{
cout<<"this is a scalene triangle.\n";
}
return 0;
}
//WAP to check if an alphabet is a vowel or a consonants
#include<iostream>
using namespace std;
int main(){
char c;
int isLowercaseVowel , isUppercaseVowel;
cout<<"Enter an alphabet:";
cin>>c;
isLowercaseVowel=(c=='a'||c=='e'||c=='i'||c=='o'||c=='u');
isUppercaseVowel=(c=='A'||c=='E'||c=='I'||c=='O'||c=='U');
if(isLowercaseVowel||isUppercaseVowel){
cout<<c<<"is a vowel";
}
else{
cout<<c<<"is a consonant";
}
return 0;
}