Sample codes
1. Program to Say hello!
{
name: Main
println("Hello, SRON!")
}OUTPUT:
Hello, SRON!
2. Program to check if a given number is even or odd.
{
name: oddEven
Int val = input_int("Enter the value :- ")
if: {
condition: ~{ val % 2 == 0 }~
println("Even number")
}
else: {
println("Odd number")
}
}TERMINAL:
Enter the value :- 17 Odd number
3. Program to use command line arguments.
TERMINAL:
sron 1 2 3 4 5 [1, 2, 3, 4, 5]
4. Program to print integers from 0 to 100,000 using for loop.
TERMINAL:
99997 99998 99999 Time Taken= 0.009
5. Program to find factorial of a given number.
TERMINAL:
Enter the value :- 5 Factorial of 5 = 120
6. Program to find if a given number is Armstrong or not.
TERMINAL:
==> Enter the value :- 153 Yes, 153 is an Armstrong Number.
Last updated