Repository navigation
Expand file tree
/
Copy pathoperatore.java
More file actions
157 lines (140 loc) · 4.3 KB
/
Copy pathoperatore.java
File metadata and controls
157 lines (140 loc) · 4.3 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import java.util.Scanner;
//TODO : lean operatore
// public class operatore {
// public static void main(String[] args) {
// // 1. Arithmetic Operators
// int a = 4;
// // int b = 6 % a; // Modulo Operator
// // 4.8%1.1 --> Returns Decimal Remainder
// // 2. Assignment Operators
// int b = 9;
// b *= 3;
// System.out.println(b);
// // 3. Comparison Operators
// // System.out.println(64<6); //! return true and flase boolean type
// // 4. Logical Operators
// // System.out.println(64>5 && 64>98);
// System.out.println(64>5 || 64>98); //! return true and flase boolean type
// // 5. Bitwise Operators
// System.out.println(2&3); //! return tyoe is int
// // 10
// // 11
// // ----
// // 10
// }
// }
//TODO : lean precedence and associativity
// public class operatore{
// public static void main(String[] args) {
// // Precedence & Associativity
// //int a = 6*5-34/2;
// /*
// Highest precedence goes to * and /. They are then evaluated on the basis
// of left to right associativity
// =30-34/2
// =30-17
// =13
// */
// //int b = 60/5-34*2;
// /*
// = 12-34*2
// =12-68
// =-56
// */
// //System.out.println(a);
// //System.out.println(b);
// // Quick Quiz
// int x =6;
// int y = 1;
// // int k = x * y/2;
// int b = 0;
// int c = 0;
// int a = 10;
// int k = b*b - (4*a*c)/(2*a);
// System.out.println(k);
// }
// }
// //TODO : lets evalute some expression
// //! x-y/2
// public class operatore{
// public static void main(String[] args) {
// Scanner s= new Scanner(System.in);
// int x,y;
// x =s. nextInt();
// y=s. nextInt();
// float result= (x-y)/2.0f;
// System.out.println(result);
// }
// }
// //TODO : lets evalute some expression
// //! b^2 - 2ac/4a
// public class operatore{
// public static void main(String[] args) {
// Scanner s= new Scanner(System.in);
// int a,b,c;
// a=s. nextInt();
// b=s. nextInt();
// c=s.nextInt();
// float result= (b*b- 2*a*c)/4.0f*a;
// System.out.println(result);
// }
// }
// //TODO : lets evalute some expression
// //! v^2 - u^2
// public class operatore{
// public static void main(String[] args) {
// Scanner s= new Scanner(System.in);
// int v,u;
// v =s. nextInt();
// u=s. nextInt();
// float result= v*v - u*u;
// System.out.println(result);
// }
// }
//TODO : lets evalute some expression
//! a*b-c
// public class operatore{
// public static void main(String[] args) {
// Scanner s= new Scanner(System.in);
// int a,b,c;
// a =s. nextInt();
// b=s. nextInt();
// c=s.nextInt();
// float result=a*b-c;
// System.out.println(result);
// }
// }
//!learn*************************************************
// Resulting data type after arithmetic operation
// Result = byte + short -> integer
// Result = short + integer -> integer
// Result = long + float -> float
// Result = integer + float -> float
// Result = character + integer -> integer
// Result = character + short -> integer
// Result = long + double -> double
// Result = float + double -> double
//!increment derement
// public class operatore{
// public static void main(String[] args) {
// /* byte x = 5;
// int y = 6;
// short z = 8;
// int a = y + z;
// float b = 6.54f + x;
// System.out.println(b); */
// // Increment and Decrement Operators
// int i = 56;
// // int b = i++; // first b is assigned i (56) then i is incremented
// int j = 67;
// int c = ++j; // first j is incremented then c is assigned j (68)
// System.out.println(i++);
// System.out.println(i);
// System.out.println(++i);
// System.out.println(i);
// int y = 7;
// System.out.println( ++y *8);
// char ch = 'a';
// System.out.println(++ch);
// }
// }