You are on page 1of 1

Practice LARP 01

Note: Problems difficulty level is gradually increasing. If any problem seems very easy or you have already
did it in LARP, move to next problem:
1. Input 2 numbers, find their sum, difference & product
2. Input 2 numbers. Perform & display result of complete division using “/” and result of integer division
using “//” operators
3. Input 3 numbers, calculate their average
4. Input 3 numbers and find quadratic roots
5. Input angle from user and print sine using "sinus" function
Enter input angle 30, you will see result -0.988 instead of 0.5. This is because function take angle in
radians. However, you may value in degree by using formula angle*PI/180, where PI is a constant
defined in LARP and many languages. Use this formula and try with same input, this time answer
should be 0.5. Similarly, you can check different other angles like 0, 45, 60, 90
6. Input word from user and print in uppercase & lowercase using functions: uppercase, lowercase
7. Input two numbers and find whether first number is divisible by second number or not?
Hint: Use % operator to find remainder
8. Calculate pay of an employee based on the hours worked. The input includes the employee total
hours worked this week and their hourly pay rate. The employee is to be paid their basic wage for the
first 40 hours worked and time-and-a-half (i.e. 50% more) for all hours above 40 (overtime pay). Output
the regular pay, overtime pay, and total pay for the week on the screen. If the employee worked 40 hours
or less, do not output any information about overtime pay. For further understanding, see example:
Hours Worked: 30 Hours Worked: 50
Hourly Pay Rate: 200 Hourly Pay Rate: 220
Regular pay 6000 Regular pay 8800
------------------------------------- Overtime 3300
Total 6000 -------------------------------------
------------------------------------- Total 12100
-------------------------------------
Normal rate is 220 but overtime rate is 330 that is 220+110
9. Take two numbers from the user and determine the largest number.
10. Input two numbers, say n1, & n2. Print numbers between n1 & n2 including both n1 & n2.
11. Repeat previous problem, if n1 is smaller than n2, print numbers from n1 to n2, otherwise print
numbers between n2 & n1.
12. Generate & print 10 random numbers in range 1-100, using function random(1,100). Use different
variables to control loop and for storage of random number, if you store, otherwise you may use
write statement with random function to print random values directly
13. Repeat previous problem & count odd & even generated numbers
14. Run loop 10 times take input from user inside loop. Again count even & odd numbers. Print count
after end of loop
15. Run loop 10 times take input from user inside loop. Sum even numbers & odd numbers separately.
Outside loop check & print whether sum of even numbers is greater or sum of odd numbers is
greater

You might also like