IF Else

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Today's agenda

float and double


G operators
if else
I Decimal 2.2 1.3 00.0 3.76 etc
I double
float
it Tong C 14 15decimalPlaces
C6 getaces

In integer default values are int

In decimal are doable


default values

Integer
along l to

Decimal
write at
float f 2.41 f the end
while initializing
float
2 Golden rules
of typecasting
41 is guarantee no loss data
if there of implicit
Em int to
long
float to double

42 there is a chance
for loss then
if we of data
can still do the conversion forcefully explicit
En to int
long
double to
float
Quiz 1
double d 2.8 28
System out pointenca

Quiz 2
33.3
float f 3.31
System out pointin
f

Qui223

float f
double d
3.41 g f
f 3.4
System out pointer d

Quiz 4
double d 3.4
I
error
d
float f
System out pointer f

double d 3.4

float d
correct
float f syntax
System out pointer f
I operation
Ruled Mathematical operation between decimal
and non decimal Result decimal

Rule 2 operation between Same category but

different capacity Result bigger size


En int A long long
A double double
float
A double double
long
int t int int

11 En int a too
int b 2009
int c a b

system out pointin c 20000


RAM ALU

Ft 1,020 100 200

20000

I
Quiz 5
int a 1000009
int b 1000009 random value
int c a b

System out pointen c

RAM ALU

5 it
dos y 1

Itai
Quiz 6
int a 1000009
int b 1000009 random value
long c axes

System out pointen c

RAM ALU

105 105 i
a b
valve
10 int
long C Grandon value
Quiz 7
int a 1000009
int b 1000009 random value
long c agg gycalculation

System out pointer c

RAM ALU

105
b
105 it't If
a
ae 1010 int
Usandonvalue

Quiz 8
int a 1000009
int b 1000009 7 1010
long c Cong a b

System out pointen c

RAM ALU

di's is it É
D 1010 long
c

Break till 9 31 Pra


Arithmetic operators
it 1 ion
209 3 2

509 10 0

Quiz 9
5
pointer 43
t
System out
ALU

É I
5.333 int
65
Quiz 10

ACU
2 0 8s
System out pointy 28 zine
48.333 8.333 double

Quiz It
System out pointer 35 9 8
Relational operators used to check relation between
en 7 Cee 2 data

2 8 y 10 2 15 7 7 2 13 7 13
N less than y true
my false false
n greater than y n
y false true
false

n greater than equal nosy true true


false
to y
2 Smaller than equal the tone
false
to g nay
a equal y false false tone
my
the true
anot equal y false
a y
Conditional Statement

11
If
1 Check Person is
if eligible for car
driving license

bald neligible
age is

try
I eligible

2 person is above too in


weight he can
if kg
participate then
only

wt too
bad Eligible

try
Iparticipate

idea when we want to do something on the basis of


condition being true
will setum
only cond that can be written
Syntax true false
Conon I
if 11 lines want to execute
you
the Cond is true
if
3

a 4 5 K valid cord but


will give you
false
b 4 5 a
C 445 Xx

a Read a number ageof person if Person is

eligible to get driving license Point eligible otherwise


don't do anything

Scanner son new scanner system.in


int Into
age son nest
1834
if age
System out pointin eligible
Quiz 12
int 2 20
27 1572
if S Hello
O.p
Hello Hello
s o.p melon

Quiz 3
int 2 209
int y 25

2571
if 22

S o.p Algoroept
3
Algordt
2571
if y
g o.p Algopods

Quiz 14
10 6 L
if
S Op Algoma Algorsept
3

if 1572531
s op 2nd
Quiz 15
int 2 55
int y 65 D D
Consists
if S Op
first
2 2 2

Second 122 gatto


if o
h
s second p
2
Leg
3

s o
platy

You might also like