17th May 2018, 9:02 PM
MeanMachine
MeanMachine - avatar
+ 14
https://code.sololearn.com/csFI4mXJaFWc/?ref=app https://code.sololearn.com/cNn10rmtfMQn/?ref=app
17th May 2018, 6:18 PM
Uni
Uni - avatar
+ 14
https://code.sololearn.com/cVrn8XvBATA5/?ref=app
18th May 2018, 4:38 PM
LukArToDo
LukArToDo - avatar
+ 9
nice
17th May 2018, 6:30 AM
Charan Leo25
Charan Leo25 - avatar
17th May 2018, 9:35 PM
Nevfy
+ 4
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc=new Scanner (System.in); double a=sc.nextDouble(); double b=a-(Math.floor(a)); if(b!=0.0){ System.out.println(""+a+"is a double value"); } else { System.out.println(""+a+"is an integer value"+((int)(Math.floor(a)))); } } } it's my try
17th May 2018, 2:22 AM
Nitish kumar jha
Nitish kumar jha - avatar
+ 3
# Python # number given as n integ, dec = tuple(str(n).split(".")) result = "integer" if all(i == "0" for i in dec) else "decimal" print(result)
17th May 2018, 5:46 PM
Pedro Demingos
Pedro Demingos - avatar
+ 2
@nitish kumar jha - Comparing floating point values to absolute numbers (such as 0.0) isn't a good plan. Some references: Very technical - https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html More accessable - http://www.floating-point-gui.de/errors/comparison/ Here's my C solution. Instead of dealing with floating point comparisons, I convert the characters after the decimal point to an integer and compare that to zero. This solution won't work if the decimal point is not proceeded with a valid number (such as ".0232"). https://code.sololearn.com/c902hiAmNjBE
17th May 2018, 3:37 PM
M. Wood
+ 1
x.is_integer()
17th May 2018, 9:23 PM
VcC
VcC - avatar
+ 1
C# shortest answer possible (I think) 60 Bytes namespace a{class b{static bool c(float d){return d%1f==0}}} EDIT: -1 byte due to 1f instead of 1.0 EDIT 2: yes, I like codegolf
18th May 2018, 9:33 AM
xXiamnerdyXx
xXiamnerdyXx - avatar