0% found this document useful (0 votes)
15 views4 pages

Basic Programing Excercise

Uploaded by

Hanock Jacob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Basic Programing Excercise

Uploaded by

Hanock Jacob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1. Write a program to perform input/output of all basic data types.

including (sets, dict, list,


tuple and strings)
2. Write a program to enter two numbers and find their sum.
3. Write a program to enter two numbers and perform all arithmetic operations.
4. Write a program to enter length and breadth of a rectangle and find its perimeter.
5. Write a program to enter length and breadth of a rectangle and find its area.
6. Write a program to enter radius of a circle and find its diameter, circumference and area.
7. Write a program to enter length in centimeter and convert it into meter and kilometer.
8. Write a program to enter temperature in Celsius and convert it into Fahrenheit.
9. Write a program to enter temperature in Fahrenheit and convert to Celsius
10. Write a program to convert days into years, weeks and days.
11. Write a program to find power of any number x ^ y.
12. Write a program to enter any number and calculate its square root.
13. Write a program to enter two angles of a triangle and find the third angle.
14. Write a program to enter base and height of a triangle and find its area.
15. Write a program to calculate area of an equilateral triangle.
16. Write a program to enter marks of five subjects and calculate total, average and percentage.
17. Write a program to enter P, T, R and calculate Simple Interest.
18. Write a program to enter P, T, R and calculate Compound Interest.

If else:
19. Write a program to find maximum between two numbers.
20. Write a program to find maximum between three numbers.
21. Write a program to check whether a number is divisible by 5 and 11 or not.
22. Write a program to check whether a number is even or odd.
23. Write a program to check whether a year is leap year or not.
24. Write a program to input any alphabet and check whether it is vowel or consonant.
25. Write a program to input any character and check whether it is alphabet, digit or special
character.

26. Write a program to input month number and print number of days in that month.
27. Write a program to count total number of notes in given amount.
28. Write a program to input angles of a triangle and check whether triangle is valid or not.
29. Write a program to input all sides of a triangle and check whether triangle is valid or not.
30. Write a program to check whether the triangle is equilateral, isosceles or scalene triangle.
31. Write a program to find all roots of a quadratic equation.

32. Write a program to input marks of five subjects Physics, Chemistry, Biology, Mathematics
and Computer. Calculate percentage and grade according to following:
a. Percentage >= 90% : Grade A
b. Percentage >= 80% : Grade B
c. Percentage >= 70% : Grade C
d. Percentage >= 60% : Grade D
e. Percentage >= 40% : Grade E
f. Percentage < 40% : Grade F

33. Write a program to input basic salary of an employee and calculate its Gross salary according
to following:
a. Basic Salary <= 10000 : HRA = 20%, DA = 80%
b. Basic Salary <= 20000 : HRA = 25%, DA = 90%
c. Basic Salary > 20000 : HRA = 30%, DA = 95%

34. Write a program to input electricity unit charges and calculate total electricity bill according
to the given condition:
a. For first 50 units Rs. 0.50/unit
b. For next 100 units Rs. 0.75/unit
c. For next 100 units Rs. 1.20/unit
d. For unit above 250 Rs. 1.50/unit
e. An additional surcharge of 20% is added to the bill

Loops

35. Write a program to print numbers from 1 to 10.:


36. Write a program to calculate the sum of first 10 natural number.
37. Write a program that prompts the user to input a positive integer. It should then print the
multiplication table of that number.
38. Write a program to find the factorial value of any number entered through the keyboard.

39. Two numbers are entered through the keyboard. Write a program to find the value of one
number raised to the power of another. (Do not use built-in method)
40. Write a program that prompts the user to input an integer and then
outputs the number with the digits reversed. For example, if the input
is 12345, the output should be 54321.
41. Write a program that reads a set of integers, and then prints the sum
of the even and odd integers.
42. Write a program that prompts the user to input a positive integer. It
should then output a message indicating whether the number is a
prime number.
43. Write a program to calculate HCF of Two given number.
44. Write a do-while loop that asks the user to enter two numbers. The
numbers should be added and the sum displayed. The loop should ask
the user whether he or she wishes to perform the operation again. If
so, the loop should repeat; otherwise it should terminate.
45. Write a program to enter the numbers till the user wants and at the
end it should display the count of positive, negative and zeros
entered.
46. Write a program to enter the numbers till the user wants and at the
end the program should display the largest and smallest numbers
entered.
47. Write a program to print out all Armstrong numbers between 1 and
500. If sum of cubes of each digit of the number is equal to the
number itself, then the number is called an Armstrong number.
For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 )
48. Write a program to print Fibonacci series of n terms where n is input
by user :
0 1 1 2 3 5 8 13 24 .....
49. Write a program to calculate the sum of following series where n is
input by user.
1 + 1/2 + 1/3 + 1/4 + 1/5 +…………1/n
50. Compute the natural logarithm of 2, by adding up to n terms in the
series
1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n
where n is a positive integer and input by user.
51. Write a program that generates a random number and asks the user to
guess what the number is. If the user's guess is higher than the
random number, the program should display "Too high, try again." If
the user's guess is lower than the random number, the program should
display "Too low, try again." The program should use a loop that
repeats until the user correctly guesses the random number.

52. Write a program to print following :

i) **********ii)* iii) *
********** ** **
********** *** ***
********** **** ****
***** *****

iv) * v) 1 vi) 1
222 212
*** 33333 32123
***** 4444444 4321234
******* 555555555 543212345

*********

You might also like