Skip to main content
Skip to content

Math · Beginner

Math Functions in Hinglish Code: ganit

Using ganit object methods and type conversion helpers.

The program

Edit anything and press Run. The output below was produced by running this exact code.

Expected output

Press Run to try it

Absolute value: 42.75Floor value: -43Ceil value: -422^10 =  1024Converted number + 10 = 52Type check: sankhya

How it works

ganit is a built-in object that groups maths helpers. ganit.abs drops the minus sign, ganit.floor rounds down and ganit.ceil rounds up — note that rounding down a negative number moves it further from zero, so -42.75 floors to -43.

ganit.pow(2, 10) multiplies 2 by itself ten times. The last part converts the text "42" into a real number with sankhya, so adding 10 gives 52 instead of joining the text into "4210". prakar confirms the type.