0
Whene int a =2.3 ; I need to stor (a) as 3
How
3 Antworten
+ 5
badreldeen ebraheem
In Java integer can't store double value. So
int a = 2.3 will be wrong
it would be
double a = 2.3;
if you want 3 then you have to use Math.ceil() then typecast with int like
int b = (int) Math.ceil(a);
+ 2
I will assume you are using Python
First of all, you need to input a float, not int.
Play with this snippet:
num = float(input() or 2.3)
num = str(num).split('.')
print(int(num[1]))
0
Thanks 😊
I am use java. In sololearn l have a problem (loan calculator) I actually did what you said
But given me an error
I don't know why