Add Two Numbers.
BEGIN
NUMBER s1, s2, sum
OUTPUT("Input number1:")
INPUT s1
OUTPUT("Input number2:")
INPUT s2
sum=s1+s2
OUTPUT sum
END
Calculate Area and Perimeter of Rectangle
BEGIN
NUMBER b1,b2,area,perimeter
INPUT b1
UNPUT b2
area=b1*b2
perimeter=2*(b1+b2)
OUTPUT area
OUTPUT perimeter
END
Find Area and Perimeter of a Square
BEGIN
NUMBER len, area,perimeter
INPUT len
area = len*len
perimeter = len*4
OUTPUT area
OUTPUT perimeter
END
Issue for driver license.
BEGIN
NUMBER age
INPUT "Enter your age for driving licence"
OUTPUT age
IF age>=16 THEN
OUTPUT "You can take driving licence"
ELSE
OUTPUT "You can't take driving licence"
ENDIF
END
Check a Number is Positive or Negative
BEGIN
NUMBER num
OUTPUT "Enter a Number"
OKU num
IF num>0 THEN
OUTPUT "Entered number is positive"
ELSE IF num <0 THEN
OUTPUT "Entered number is negative"
ELSE
OUTPUT "Entered number is zero"
ENDIF
END
Find the biggest of three (3) Numbers.
BEGIN
NUMBER num1,num2,num3
INPUT num1
INPUT num2
INPUT num3
IF num1>num2 AND num1>num3 THEN
OUTPUT num1+ "is higher"
ELSE IF num2 > num3 THEN
OUTPUT num2 + "is higher"
ELSE
OUTPUT num3+ "is higher"
ENDIF
END
Print Numbers from 1 to 100.
BEGIN
NUMBER counter
FOR counter = 1 TO 100 STEP 1 DO
OUTPUT counter
ENDFOR
END
Find Sum of Natural Numbers (1 to 100)
BEGIN
NUMBER counter, sum=0
FOR counter=1 TO 100 STEP 1 DO
sum=sum+counter
ENDFOR
OUTPUT sum
END
Read 50 numbers and find their sum and average.
BEGIN
NUMBER counter, sum=0, num
FOR counter=1 TO 50 STEP counter DO
OUTPUT "Enter a Number"
INPUT num
sum=sum+num
ENDFOR
OUTPUT sum
END
Read 10 numbers and find sum of even numbers.
BEGIN
NUMBER counter, sum=0, num
FOR counter=1 TO 10 STEP 1 DO
OUTPUT "Enter a Number"
INPUT num
IF num % 2 == 0 THEN
sum=sum+num
ENDIF
ENDFOR
OUTPUT sum
END