Anda di halaman 1dari 2

Exercises Topic: Programming Techniques Write pseudo code for the below: Formula Based 1.

Accept three numbers from user, find the largest of three numbers and print the largest number. 2. Find area and perimeter of a triangle. 3. Menu driven program to convert the given temperature from Fahrenheit to Celsius and vice versa. 4. Display the grade of a student using switch statement (Distinction: >=80, First Class: >=60, Pass>= 40, Fail < 40). 5. Check whether the given year is leap year or not. Iteration Based 1. Calculate sine, cosine, and exponential series as a menu driven program. (cos(x) = 1-x^2/2!+x^4/4!-x^6/6!+.x^n/n!) (sin(x) = x-x^3/3!+x^5/5!-x^7/7!+.x^n/n!) (e^x=1+x+x^2/2!+x^3/3!+.x^n/n!) 2. Display Fibonacci series up to a given limit 3. Generate prime numbers up to a given limit 4. Find the sum of digits of a given number 5. Generate all twin primes in a given range of numbers. (Twin primes are 2 consecutive odd numbers which are both primes. Eg:- 11 and 13) 6. Check whether the given numbers are odd or even. 7. Write a program to accept records of n employees. The input contain name, age and basic salary. Calculate total salary of the employee as Total salary = Basic pay + DA + HRA DA = 10 % of basic pay HRA = 5 % of basic pay Display the name, age and total salary of the employees in descending order on the basis of total salary. 8. Check whether the given number is palindrome or not. If not, print the number in reverse order. 9. Write a program which replaces consecutive blanks with a single blank. 10. An electricity board charges the following rates to domestic users to discourage large consumption of energy. For Ist 100 units 60 ps per unit For next 200 units 80 ps per unit Beyond 300 units 90 ps per unit

All users are charged a minimum of Rs. 50/-. If the total amount is more than 300, then an additional surcharge of 15% is added. Write a program to read the following data and display it in the form of a bill. The details are Name of the consumer, consumer number, address, billing date and no of units consumed Matrix related problems: 1. Compute the norm of the given matrix. The norm of a matrix = squareroot of the sum of the squares of the elements of the matrix. 2. Find the row sum and the column sum of a matrix. 3. Sum the elements above and below the diagonal of the given matrix. 4. Check whether the given matrix is a magic square or not. Magic square: column sum = row sum = diagonal sum and elements in the matrix should be distinct. Eg: Magic Square 8 1 6 3 5 7 4 9 2 5. 6. 7. 8. 9. Print the lower and upper triangle of the matrix. Multiply two matrices. Transpose of a matrix. (elements of the rows and columns are interchanged.) Check whether the given matrix is a diagonal matrix. Check whether the given matrix is an identity matrix.

Searching (FlowChart) 1. Accept a given number of numbers and search for a given number, using linear search. 2. Accept a given number of sorted numbers and search for a given number, using binary search. Sorting (FlowChart) 3. Accept a given number of numbers, sort them using bubble sort and display the sorted list. 4. Accept a given number of numbers, sort them using insertion sort and display the sorted list.

Anda mungkin juga menyukai