Can number outputs only be represented in int or floats or are there any way to represent a square root in the output? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Can number outputs only be represented in int or floats or are there any way to represent a square root in the output?

Just tell me how if there is a way and a code with comments will be helpful thanks!

8th Aug 2017, 2:47 PM
HJ🐓TDM
3 Réponses
+ 10
Numbers can be *stored* as either integers or floating-point values. As for output, it is up to you to do the magic through calculations. https://code.sololearn.com/cbyhPCt7aOau/?ref=app
8th Aug 2017, 3:12 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
There are languages which can store irrational numbers and make proper, non-decimal calculations on them. Neither of those is available at SoloLearn, though...
8th Aug 2017, 3:19 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
in Java we have function sqrt(/*number*/);
8th Aug 2017, 3:10 PM
Даниил Титов
Даниил Титов - avatar