This document outlines a programming assignment for the University of Engineering and Management, Kolkata, focusing on various problem-solving tasks. It includes instructions for writing programs that cover topics such as calculating the area of a triangle, finding distances between points, checking for even or odd numbers, determining grades based on marks, and calculating income tax. Each task specifies the required input and expected output, providing a comprehensive guide for students to practice their programming skills.
This document outlines a programming assignment for the University of Engineering and Management, Kolkata, focusing on various problem-solving tasks. It includes instructions for writing programs that cover topics such as calculating the area of a triangle, finding distances between points, checking for even or odd numbers, determining grades based on marks, and calculating income tax. Each task specifies the required input and expected output, providing a comprehensive guide for students to practice their programming skills.
Course Name: Programming for Problem Solving Laboratory Course Code: ESCCS291 1. Write program, which reads a, b and c as sides of a triangle and prints area. Hint: area = sqrt( s(s-a)(s-b)(s-c) ) and s = (a+b+c)/2] [sqrt(x) will find square root] Input 5 7 10 output 16.24. 2. Write program, which reads x1, y1, x2 and y2 and finds distance between points (x1,y1) and (x2,y2). input 3, 7, 11, 13 output 10. 3. Write program, which reads a, b and c as sides of a triangle and prints whether angle A is 90 0 or not. [Hint: if (a2 = = b2+c2) ] [Do not use cos-1 etc] 4. Write a Program to check whether a number is even or odd. 5. Write a Program to test whether any year is Leap year or not 6. A student is awarded Ex grade if he gets more than 90 marks. He is awarded A grade if marks are between 80 and 89. Similarly range for B, C, D and P are 70-79, 60-69, 50-59, and 35-49 respectively. The student is awarded F grade if he gets less then 35 marks. Program reads marks of a student and prints his grade. 7. Write a Program to reverse the digits of an integer. 8. Write a Program to print the summation of digits of user given input number. 9. Write a Program to check whether a given number is Palindrome or not. 10. Write a Program to find all the Fibonacci numbers for a given range. 11. Write a Program to find all prime numbers within a given range. 12. Write a Program to calculate the Factorial of any integer. 13. No income tax is to be paid if income is less than 5000. If income is between 5000 and 6000 then tax is 10% of the amount by which the income exceeds 5000. If income is between 6000 and 15000 then the tax is 100 + 20% of the amount by which the income exceeds 6000. If income is more than 15000 then the tax is 1900 + 30% of the amount by which the income exceeds 15000. e.g. if income is 10000 then the tax will be 100 + (10000-6000)*20/100 = 900. Write a program, which reads income and calculates the income tax. 14. Write a program, which reads a number X and prints a number Y. Y=X+10 if X is 6. Y is X*X if X is 7. Y is 2*X+4 if X is 12. Otherwise Y is X*6-1. (use switch) 15. Write a program, which reads three integers X, Y and Z and prints Y+Z if X is 0. If X is 1 then Y-Z is printed. If X is 2 then Y*Z is printed. If X is 3 then Y/Z is printed. (use switch)