APR 2022 Programming For Problem Solving
APR 2022 Programming For Problem Solving
Page 1 of 2
UNIT-IV
7. a) Differentiate between malloc() and calloc(). (6M)
b) Write a C Program to find sum of n elements entered by user. To perform this program,
allocate memory dynamically using malloc() function. (8M)
(OR)
8. Write a C Program to create a function that receives two integers and passes back the greatest
common divisor. The calculation of greatest common divisor can be done using Euclid
method of repetitively dividing one number by the other and using the remainder (modulo).
When the remainder is zero, the gcd has been found. Once you know the gcd the least
common multiplier is determined by (14M)
𝑛𝑢𝑚 1∗𝑛𝑢𝑚 2
lcm=
gcd
(𝑛𝑢𝑚 1,𝑛𝑢𝑚 2)
UNIT-V
9. a) Explain arrays of structures with suitable example program. (7M)
b) Develop a C program to create a structure for employee which includes details such as
empno, DOB(dd-mm-yyyy) and salary. Use this structure for ‘n’ employees. Read the the
data of each employee from the user and display them. (7M)
(OR)
10. What are various operations that can be performed on files? Explain each operation with
syntax and example. (14M)
*****
Page 2 of 2