You are on page 1of 5

1. Add Two Numbers and show the result.

x= [ ]

y= [ ]

num= x + y

print (“The sum of the number is:” + num)

2. Calculate Area and Perimeter of Rectangle.

x= [ ]

y= [ ]

perimeter= x*2 + y*2

area = x*y

print (“The perimeter of the rectangle is:” + perimeter)

print (“The area of the rectangle is:” + area)

3. Find Area and Perimeter of a Square.

a= [ ]

b= [ ]

perimeter= a*2 + b*2

area= a * b

print (“The perimeter of the square is:” + perimeter)

print (“The area of the square is:” + area)

4. Find Area Of Circle using Radius.

pi= 3.1416

radium= [ ] ^2

area= pi * radium
print (“The area of the circle is:” + area)

5. Find Perimeter Of Circle using Radius.

pi= 3.1416

radium= [ ]

perimeter= 2 * pi * radium

print (“The perimeter of the circle is:” + perimeter)

6. Calculate sales taxes.

Tax= .16

Total= [ ] * tax

print (“The total price is:” + total)

7. Ask for a person's age and tell him/her if he/she can get a driver's license

Years= [ ]

if (Years < 18) {

1. print (“You cant get a driver's license”)

else {

1. print (“You can get a driver's license”)

8. Check a Number is Positive or Negative.

num= [ ]
if (num < 0) {

print (“Your number is negative”)

else if (num > 0) {

print (“Your number is positive”)

else {

print (“Your number is 0”)

9. Find the biggest of three (3) Numbers.

number1= [ ]

number2= [ ]

number3= [ ]

if (number1 > number2, number3) {

print (“The biggest number is” + number1)

else if (num2 > num1, num3) {

print (“The biggest number is” + number2)

else {

print (“The biggest number is” + number3)

10. Print Numbers from 1 to 100.

num= 1

while num <= 100 {

print(num)
num = num + 1

11. Find Sum of Natural Numbers (1 to 100).

number= 0

result= 0

while number <= 100 {

number = number + 1

result= result+ number

print(“The result of the sum is:” + result)

12. Read 50 numbers and find their sum and average.

number= 0

result= 0

Average= result/50

repeat (50) {

result= result+ number

print=( )

print(“The result of the sum is:” + result

print(“The average is:” + average

13. Read 10 numbers and find sum of even numbers.

Find the sum of all elements of array.

a1= [ ]

a2= [ ] ^2
a3(“The square root is:” + root)

a4= 23

Print(a1, a2, a3 , a4)

14. Calculate square of a number.

num= [ ]

square= num ^2

print(“The square is:” + square)

15. Calculate the Square Root of a Number.

num= [ ]

root= num ^2

print(“The square root is:” + root)

16. Swap two variables with using a temporary variable.

b1= [ ]

b2= [ ] ^2

sum= b1 + b2

print(suma)

17. Print Numbers from 1 to n.

n1= 1

n2= 2

n3= 3

n4= n

print(n1…n4)

You might also like