+ 2

There is no output

I am a beginner and just completed the basic and loops of java, the first two things and wrote a simple code about addition, multiplication and others with user input. Its working fine with small numbers but is not working with bigger numbers, is it because of the processing power of phone ?

21st Jul 2020, 2:39 AM
Shouvik
Shouvik - avatar
7 odpowiedzi
+ 1
Shouvik first of all, Solo learn uses cloud based server and does not depend on your phone's processor so don't worry about processing power of device the only thing you need to have a good internet connection Maybe the problem occurs in your code due to a long value of integer. The int value is 4 bytes in size where one bit indicates the sign, resulting in a range of -2,147,483,648 to 2,147,483,647 and thus can handle most math values quite easily. The longint uses 8 bytes with one sign-bit and a range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Yes, it can handle considerably larger values with a lot of precision uses of "long" or "double"( double also have 8 bytes of size) data type on the place of int might be helpful.
21st Jul 2020, 3:17 AM
PRANAV SINGH
+ 2
So char data type can store 1 byte of data, int 4 byte and double 8 byte....?
21st Jul 2020, 6:02 AM
Shouvik
Shouvik - avatar
+ 1
It's quite sure not about your phone... Please define "bigger numbers" and "others" (regarding the operations).
21st Jul 2020, 2:45 AM
Sandra Meyer
Sandra Meyer - avatar
+ 1
PRANAV SINGH thanks, this must be the case, good to know about this ☺☺ and I don't understand the 8 bit and 4 bit and what does it mean by range 😅😅
21st Jul 2020, 4:35 AM
Shouvik
Shouvik - avatar
+ 1
Shouvik 8 bytes and 4 bytes represent the capacity of data type. For example Size of char is 1 byte Size of int is 4 bytes Size of double is 8 bytes Etc. And 1 byte represent the capacity of 8 bits.
21st Jul 2020, 5:59 AM
PRANAV SINGH
+ 1
Okk
21st Jul 2020, 6:04 AM
Shouvik
Shouvik - avatar
0
Yes
21st Jul 2020, 6:03 AM
PRANAV SINGH