Programming Problems

  1. Write a program to take two numbers from user and add, subtract, multiply, and divide those numbers (calculator program).
  2. Write a program to print the ASCII value of a character.
  3. Write a program to convert ASCII value to a character.
  4. Write a program to take the marks obtained by a student in five different subjects through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.
  5. Write a program to calculate the arithmetic mean of 5 numbers.
  6. Write a program to find the square root of a number.
  7. Write a program to find SIN, COS, sec, TAN, and COSEC of an angle.
  8. Write a program to find quotient and remainder.
  9. Write a program to swap two numbers.
  10. Write a program to swap two numbers without using a third variable.
  11. Write a program to print the sum of digits of a three-digit number.
  12. If a four-digit number is input through the keyboard, write a program to obtain the sum of the first and last digit of this number.
  13. Write a program that take a 4-digit number form user (i.e., 4185) and show sum of cubes of all digits in the number. (hint: Sum = 43+13+83+53)
  14. Write a program to reverse a number (hint: 435 ->534).
  15. Write a program that take length of a side and calculate area of a square using formula area = side x side.
  16. Write a program to find the area and perimeter of a rectangle, using the formula area = l*w and perimeter = 2*(L+W).
  17. Write a program to find the area of a triangle using the formula.
  18. Write a program to find surface area and volume of a cone.
  19. Write a program to find the perimeter of a parallelogram, using the formula perimeter = 2 (side + base).
  20. Write a program to take radius of a sphere and calculate its Area, circumference and volume.
  21. Write a program to find the area and circumference of a circle, using the formula area = π *radius2 and circumference = 2 * π * radius.
  22. Write a program to compute the area of a sector of a circle. It inputs the radii and angle in radians of a sector of a circle. Formula = (radii*radii*angle)/2
  23. Write a program that take length of three sides of a triangle and calculate the area of a triangle.
  24. Write a program to convert centigrade to Fahrenheit using formula, t(°f) = t(°c) × 9/5 + 32 and Fahrenheit to centigrade using formula, t(°c) = (t(°f) – 32) × 5/9.
  25. Write a program to find simple interest using the formula, simple interest = (p * t * r)/100, where p = principal amount, t= time period and r= rate of interest.
  26. A program that asks the user how many eggs he has and then tells the user how many dozen eggs he has and how many extra eggs are leftover.
  27. Write a program to solve the equation, y = b2 – 4ac. The program should ask the values of variables a, b and c from the user and display the result.
  28. Write a program that get a number from user and display its square and cube.
  29. Write a program that take age of a person in year and show his age in days and months.
  30. Write a program that take price of book and number of books from user and calculate bill.
  31. Write a program that asks the user for his basic salary. It calculates 35% house Rent, 25 % medical allowance 15% dearness allowance and show its gross salary.
  32. Write a program that take total marks and obtained marks and print its percentage.
  33. Write a program to calculate covered distance S. Take Time t, initial velocity vi and acceleration a from user and use formula s = vit+1/2at2
  34. Write a program to take distance in KM and convert it into miles. 1 Mile = 1.69 KM
  35. Write a program to take weight in pounds and convert into Kg.1 pound =0.453592kg
  36. Write a program to take marks of five books of a student and calculate its total marks and percentage.
  37. Write a program that takes number of gallons form user and display it in cubic foot ( hint 1 cubic foot = 7.481 gallons)
  38. Write a program that take rainfall in mm and convert it into rainfall in inches (hint: 1 inch = 25.4mm)
  39. Write a program to take three numbers and calculate their dicriminant ( hint: disc = b2-4ac)
  40. The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.
  41. In a town, the percentage of men is 52. The percentage of total literacy is 48. If total percentage of literate men is 35 of the total population, write a program to find the total number of illiterate men and women if the population of the town is 80,000.
  42. A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.
  43. If the total selling price of 15 items and the total profit earned on them is input through the keyboard, write a program to find the cost price of one item.
  • Leave a Comment