+ 1

Question and solution

Question : System.out.print((int'A'+10)/19); Is solution true ????????????????????????? Solution : Int char= 32 (1+32+32+10)/19=3.9 Because it's not double: output is 3

19th Jan 2024, 9:04 AM
MIlad Khan
MIlad Khan - avatar
11 Answers
+ 5
MIlad Khan understand that (int)'A' evaluates to the value 65, which is the ASCII code for 'A'. ((int)'A' +10)/19 = (65 + 10)/19 = (75)/19 = 3 //integer math
19th Jan 2024, 6:30 PM
Brian
Brian - avatar
+ 4
When dividing an integer by an integer, the result will be an integer. If you want to get a real number, then you need to convert one of the numbers to a real number, for example like this: System.out.print(((int)'A'+10)/19.);
19th Jan 2024, 9:44 AM
Solo
Solo - avatar
+ 3
In Java int divide by int always returns int
19th Jan 2024, 9:06 AM
A͢J
A͢J - avatar
+ 2
System.out.print((int)'A' + 10) / 19); Check this : )
19th Jan 2024, 4:39 PM
NextJS Boi
NextJS Boi - avatar
+ 1
I checked that's output 3
19th Jan 2024, 4:53 PM
MIlad Khan
MIlad Khan - avatar
0
Please explain more
19th Jan 2024, 9:17 AM
MIlad Khan
MIlad Khan - avatar
0
Bro if I do 19/10 that's 1 but the output will get 3.
19th Jan 2024, 10:46 AM
MIlad Khan
MIlad Khan - avatar
0
MIlad Khan I don't understand anything. What does 19/10 have to do with it? Are you not satisfied with my answer? Have you looked at the result of my example? If you want to contact someone personally, click @ and select the desired user from the list that opens.
19th Jan 2024, 7:14 PM
Solo
Solo - avatar
0
Brian , finally , I received complete answer that value 65 you told
19th Jan 2024, 8:40 PM
MIlad Khan
MIlad Khan - avatar
0
The difference Html with C++ is that C++ is used for System machines and computer and mobile but HTML only using for creating root and structure of website,
19th Jan 2024, 8:46 PM
MIlad Khan
MIlad Khan - avatar
0
Oh
21st Jan 2024, 7:38 AM
Raju Kumar
Raju Kumar - avatar