Quiz+5+Programs

Program 1

var a, b, c:int a:= 15 b:= 7

loop locate (a, b) get c put "Happy" end loop

Program 2

loop get b a:=a+b exit when b = 10 end loop

Program 3

var a:int const PI:=3.14 put "What is the radius?" get a put "What is PI?" get PI put "The area of your circle is ", PI * a**2

Program 4 %The "averages" program computes the average of marks entered var mark: string var sum:=int sum:0.0 put Enter marks for count:=1..5 put "count" get marks sum=sum +mark end if

Program 5 Test data: 5,15, +, 6, 8, *, 5, 2, -

var number1, number2, total:int var operation:string for i:1..2 put "Enter the first number..." get number1 put "Enter the second number..." get number2 put "Enter the operation..." get operation if operation = "+" then total := number1 + number2 elsif operation = "-" then total:= number1 - number2 elsif operation ="*" then total := number1 * number2 end if end for put "The answer is ": 16, total: 2, "."