How output is 1 ???? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

How output is 1 ????

please explain (but I think output should be 4) https://code.sololearn.com/cSI5P52ry5Nu/?ref=app

11th Jan 2018, 2:42 PM
Ramshek Rana
Ramshek Rana - avatar
2 Réponses
+ 17
Yes, / (division operator) gives the int of the operation dropping the fractional part.. so 1/3 though it is 0.333 it is taken as 0 which causes the output to be one. You can give float input as pow(64,0.333)
11th Jan 2018, 3:26 PM
Frost
Frost - avatar
+ 4
1/3= 0.33 and int do not fraction part so finally n^0= 1
11th Jan 2018, 2:50 PM
Ramshek Rana
Ramshek Rana - avatar