-
Notifications
You must be signed in to change notification settings - Fork 0
/
operators.dart
75 lines (66 loc) · 1.19 KB
/
operators.dart
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
/*
Operators
1.Arithmetic Operators
2.Relational Operators
3.Test Operators
4.Increment and Decrement Operators
5.Assignment Operators
6.Logical Operators
7.Conditional Operators
8.Cascade Notation
9.Bitwise Operators
*/
main(){
//1.Arithmetic Operators
var a=30;
var b=20;
print(a+b);
print(a-b);
print(a*b);
print(a/b);
print(a%b);
print(a~/b);
//2.Relational Operators
print(a>b);
print(a<b);
print(a>=b);
print(a<=b);
print(a==b);
print(a!=b);
//3.Test Operators
print(a is int);
print(a is String);
print(a is! String);
//4.Increment and Decrement Operator/Unary Operator
print(a++);
print(a);
print(--b);
print(b);
//5.Assignment Operator
a+=30;
print(a);
//6.Logical Operator
if(a==10 && b==20){
print('Yes');
}
else{
print("No");
}
//7.Conditional Operator
print(a>20 ? 'a is greater than 10':'a is less than 10');
//8.Cascade Notation
var str='Harman';
print(str.toLowerCase().substring(2));
//9.Bitwise Operator
var c=5;
var d=7;
print(c);
print(d);
print(c & d);
print(c | d);
print(c & ~d);
print(c ^ d);
print(c ^ d);
print(c >> d);
print(c << d);
}