Menu - 634811806493471858 - CS1202 UNIX & C Programming Lab Assignments
Menu - 634811806493471858 - CS1202 UNIX & C Programming Lab Assignments
CS1202
UNIX & C PROGRAMMING
LAB ASSIGNMENT
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA
[Problems in BOLD are optional]
1. Write an interactive program that will read in a +ve integer value and determine the following
i) If the integer is a prime number
ii) If the integer is a Fibonacci number
2. WAP in C to compute sinx = x x 3/3! + x5/3! x7/7! .. Continue adding successive terms in the
series until the value of the next term becomes smaller (in magnitude) than 10 -5. Test the program
for x = 1, x = 2, and x = 3. In each case display the number of terms used to obtain the final
answer.
3. WAP to generate every 3rd integer beginning with i = 2 and continue for all integers that are less
than 150. Calculate the sum of those integers that are evenly divisible by 5.
4. WAP to find whether a given year is a leap year or not. Modify it to generate a list of leap years
between two year limits given by user.
5. WAP to display the following pattern :
11
11
10
11
11
10
9
10
11
11
10
9
8
9
10
11
6. Using Ternary / Conditional operator find the greatest among 3 numbers.
7. WAP to convert a decimal number into an equivalent number of the input base. Test your program
for base 2,8,10 & 16.
8. WAP to read a number n, and print it out digit-by-digit, as a series of words. For e.g. 123 would be
printed as one two three.
9. WAP to check whether any input +ve integer is palindrome or not.
10. WAP to simulate a simple calculator (+ - / * %) that takes two operands and an operator as input
and displays the result.
11. WAP to find the GCD of two input +ve integer numbers.
12. WAP to swap the values of two variables without using a third variable.
13. Read a line of mixed text, and then write it out with all lower case and uppercase letters reversed,
all digits replaced by 0s and all other characters (non-letters and non-digits) replaced by *.
14. WAP to find the product of two matrices A and B. Display the source matrices and product matrix
C in matrix format.
15. WAP to find whether a given matrix is a triangular matrix or not.
16. WAP to find the transpose of a matrix. Display the source and the transposed matrix in matrix
format.
17. Implement Prob. No. 14 to 16 using functions for reading, manipulating and displaying the
corresponding matrices in matrix form.
18. WAP to sort a list of strings alphabetically using a 2-dim. Character array.
19. WAP to display the row sum and the column sum of an input 2- dim. Matrix. Display the source
matrix with row and column sum.
20. Write a recursive function to calculate S = 2 + 4 + 6 + 8 + +2N. Implement the function in a
complete C program.
21. Write a function that accepts two arguments an array and its size n. It performs Bubble up
sort on the array elements. Using indirection operator * implement this in a complete C
program. Display the source and the sorted array.
22. Using pointer, write a function that receives a character string and a character as argument.
Delete all occurrences of this character in the string. The function should return corrected
string with no holes.
23. Write a function for reading character string using pointer. Calculate the length of the string
(without using strlen ()). Finally print the string in reverse order, using pointer.
24. Implement prob. No. 14 using pointers representation of 2 dim. array.
25. Implement prob. No. 15 using pointer representation of 2 dim. array.
***************