-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvar.cpp
139 lines (112 loc) · 3.6 KB
/
var.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// #include <iostream>
// using namespace std;
// int main(){
// cout << "MANASA";
// return 0;
// }
// data_type variable_name;
// #include <iostream>
// using namespace std;
// int main() {
// int age = 25; // Integer variable
// double salary = 55000.5; // Double (floating point) variable
// char grade = 'A'; // Character variable
// bool isEmployed = true; // Boolean variable
// cout << "Age: " << age << endl;
// cout << "Salary: " << salary << endl;
// cout << "Grade: " << grade << endl;
// cout << "Employed: " << isEmployed << endl;
// return 0;
// }
// Data Types
// C++ has various data types that determine the size and type of data that can be stored in a variable.
// Common Data Types:
// int: Stores integers (e.g., 10, -5).
// float: Stores floating-point numbers (e.g., 3.14, -0.001).
// double: Stores double-precision floating-point numbers.
// char: Stores a single character (e.g., 'a', '1').
// bool: Stores boolean values (true or false).
// #include <iostream>
// using namespace std;
// int main() {
// int num = 10;
// float pi = 3.14f;
// double e = 2.71828;
// char letter = 'C';
// bool isTrue = true;
// cout << "Integer: " << num << endl;
// cout << "Float: " << pi << endl;
// cout << "Double: " << e << endl;
// cout << "Character: " << letter << endl;
// cout << "Boolean: " << isTrue << endl;
// return 0;
// }
// Operators
// Operators in C++ are symbols that perform operations on variables and values.
// Types of Operators:
// Arithmetic Operators: +, -, *, /, %
// Assignment Operators: =, +=, -=, *=, /=
// Comparison Operators: ==, !=, >, <, >=, <=
// Logical Operators: &&, ||, !
// Increment/Decrement Operators: ++, --
// #include <iostream>
// using namespace std;
// int main() {
// int a = 10, b = 20;
// // Arithmetic Operators
// cout << "a + b = " << (a + b) << endl;
// cout << "a - b = " << (a - b) << endl;
// cout << "a * b = " << (a * b) << endl;
// cout << "b / a = " << (b / a) << endl;
// cout << "b % a = " << (b % a) << endl;
// // Comparison Operators
// cout << "a == b: " << (a == b) << endl;
// cout << "a != b: " << (a != b) << endl;
// cout << "a > b: " << (a > b) << endl;
// cout << "a < b: " << (a < b) << endl;
// // Logical Operators
// cout << "(a > 5) && (b > 5): " << ((a > 5) && (b > 5)) << endl;
// cout << "(a > 5) || (b > 25): " << ((a > 5) || (b > 25)) << endl;
// cout << "!(a == b): " << (!(a == b)) << endl;
// // Increment/Decrement Operators
// cout << "a++ = " << a++ << endl;
// cout << "++b = " << ++b << endl;
// return 0;
// }
// #include <iostream>
// using namespace std;
// int main() {
// int a,b;
// cout << "Enter a:";
// cin >>a;
// cout << "Enter b:";
// cin >>b;
// int sum =a+b;
// int diff =a-b;
// int mul =a*b;
// int div =a/b;
// int mod =a%b;
// cout<<"sum="<<sum<<endl;
// cout<<"diff="<<diff<<endl;
// cout<<"mul="<<mul<<endl;
// cout<<"div="<<div<<endl;
// cout<<"mod="<<mod<<endl;
// return 0;
// }
#include <iostream>
#include <vector>
using namespace std;
int amin(){
int n= 5;
int arr[5] ={1,2,3,4,5};
for(int start =0; start<n;start++){
for(int end =start; end<n;end++){
for(int i=start;i<=end;i++){
cout <<arr[i];
}
cout << " ";
}
cout <<endl;
}
return 0;
}