Professional Documents
Culture Documents
3. Write a program that reads the percentage obtained by the students and determines and prints the class obtained by the student as per the following rules (use switch case)
Percentage Class
0 - 39 Fail
40 - 59 Second class
60 - 79 First class
80 - 100 Distinction
4. Write a program to calculate the area of circle/rectangle/triangle. Determine whose area is to be calculated by accepting the code from the user. Let (use switch case)
C indicate circle ,
R indicate rectangle,
T indicate triangle.
use symbolic constant to define the value of pie.
7. Consider the following foreign currencies and their equivalents to one u.s. dollar :
Write an interactive menu driven program that will accept two different currencies and return the value of the second currency per one unit of the first currency.
8. Generate the following "pyramid" of digits, using nested loops
1
232
34543
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
ABCDEFGHGFEDCBA
ABCDEFG GFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABC DCBA
ABC CBA
AB BA
A A
11. Write a program to find the greatest common divisor of two integers.
12. Write an interactive 'c' program that will convert a date, entered in the form mm-dd-yy (example : 4-12-1996) into an integer that indicates the
number of days beyond January 1,1990.
13. Write an interactive program that will read in a positive integer and determine the following
(1) if the integer is a prime number
(2) if the integer is a Fibonacci number
write the program in such a manner that it will execute repeatedly, until a zero value is detected for the input quantity.
14. The sine of x can be calculated approximately by summing the first n terms of the infinite series
sin x = x - x3 /3! + x 5/5! – x7 /7! + ...........
write a 'c' program that will read in a value for x and then calculates its sine. Continue adding successive terms in the series until the value of the
next term becomes smaller than 10 to the powe -5.
15. A leap year is any year divisible by 4, unless the year is divisible by 100, but not by 400. Write a program to tell if a year is a leap year.
16. A professor generates letter grades using following table
% | grade
_________________
0-60 | F
61-70 | D
71-80 | C
81-90 | B
91-100| A
18. Write a program that converts numbers to words. For example , 895 should result in " eight nine five".
19. Modify the previous program to handle numbers 0 through 100 so that all numbers come out as we really say them. For example, 13 would be "thirteen",
85 woud be "eighty five" and 100 would be "one hundred.
20. Write a 'c' program that reads in two matrices and multiply them. Display the resultant matrix.
21. Write a 'c' program that reads in two matrices and add them. Display the resultant matrix.
23. Write a 'c' program that reads a unsorted list of numbers in an array. Sort the given array and then searches a given number in the array using
binary search technique.
24. Write a 'c' program to sort a given list of names using insertion sort technique.
25. Write a 'c' program to sort a given list of names using selection sort technique.
26. Write a 'c' program to sort a given list of names using bubble sort technique.
27. Write a 'c' program to merge two given sorted lists of names into single sorted list of names.
28. The annual examination results of 100 students are tabulated as follows
_____________________________________________________________
roll no. Subject1 subject2 subject3
_____________________________________________________________
_____________________________________________________________
31. Write a program to find the kth smallest number in an array (without sorting the array)
32. Write a program to replace a particular word by another word in a given string. For example, the word "pascal" should be
replaced by "c" in the text "it is good to program in Pascal language".
33. Write a program to find the longest monotone sequence in a given list of numbers.
34. Write a program to generate all permutations of the first n integers taken r at a time. The value of n and r must be greater than zero.
for example if n refers to first 5 integers and they are to be sampled 3 at a time (i.e. R = 3), the first few and the last permutation are listed below
1 1 1
1 1 2
1 1 3
1 1 4
1 1 5
1 2 1
1 2 2
1 2 3
.........
.........
.........
5 5 5
35. Write a program to generate all combinations of the first n integers taken r at a time. The value of n and r must be greater than or equal
to one. The ten combinations of the first 5 integers taken 3 at a time are :
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5
38. Write a program to read a string and display no of occurrences of each character present in the string.
39. Write a program to encrypt a string entered by the user. The Encryption table for random encryption should be given in the program and used for encryption.
40. Write a program to sort a given list of names without using string functions.
41. Given a score of n students examination marks ( in the range 0 to 100) make a count of the number of students that obtained each possible mark
and show the result in the form of the histogram.
_______________________________________________________________________________