+ 1

Plzz make a program that input and output is

input: 25.7657 output: 25 .7657

16th Jan 2018, 9:33 AM
Harsh Agrawal
Harsh Agrawal - avatar
6 ответов
+ 30
public class Program{ public static void main(String[] args){ double a=123.543; int b=(int)a; /*since double to int type is an explicit type conversion, so we need to use cast operator to convert double value to integer value it will not round it off , but it will just remove the decimal part */ System.out.print(b+"\n"+(a-b)); } } /* (int) is used to cast double value to an integer value //ie b will be 123 //(a-b) will give 123.543 - 123 that is .543 //"\n" is user for taking text or value to a next line //hope it helps ☺ */
16th Jan 2018, 11:12 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
bhai can u make it this program with simple method I mean without using scanner,buffer reader etc make it with impure function plxxzzzzzz
16th Jan 2018, 11:08 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 2
to plzzz bhej do
16th Jan 2018, 11:11 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 2
thnx bro n can u also explain why we use this????
16th Jan 2018, 11:15 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
thnxxxx bro
16th Jan 2018, 11:24 AM
Harsh Agrawal
Harsh Agrawal - avatar
0
Explain is clearly written in the comments , can you didn't understand simple English.
16th Jan 2018, 4:05 PM
Mr.Curious
Mr.Curious - avatar