PRINTING
println("Hello")
printf("Hello")
VARIABLES
age = 15
name = "Rudra"
letter = 'A'
MATH
x = 10 + 5
x = 10 * 2
x = sqrt(25)
x = pow(2, 3)
x = abs(-5)
INPUT
scanf(age)
IF
if age > 10
println("Teen")
else
println("Child")
WHILE
while x < 10
println(x)
x++
FOR
for i = 1 to 5
println(i)
FUNCTIONS
function square(x)
return x * x
ARRAYS
numbers = [1, 2, 3]
numbers[0] = 10
MULTI-DIMENSIONAL ARRAYS
grid = array(3, 3)
CHARACTERS
letter = 'A'
x = ascii(letter)
letter = char(65)
x = charAt("Hello", 1)
STRINGS
upper("hello")
lower("HELLO")
trim(" hello ")
contains("hello", "ell")
startsWith("hello", "he")
endsWith("hello", "lo")
indexOf("hello", "ll")
replace("hello", "l", "x")
equals("hello", "hello")
OTHER
clrscr()
random(1, 10)
length("Hello")
str(123)
int('A')
Paste Java code below:
SudhirCode: