[Link](I.
T) 2nd Semester
Problem Sheet-1
1. Define a structure named Census with the following three members:
- city name
- population of the city
- literacy level
Write a program to perform following tasks:
-To read details for 10 city
- To sort the list alphabetically
-To sort the list based on literacy level
-To sort the list based on population
- To display sorted list
2. Define a structure called cricket that will describe the following information:
(Player name, Team name, batting average)
Using cricket, declare an array player with 20 elements and write a program to read the information
about all the 20 players and print a team-wise list containing names of players with their batting
average.
3. Define a structure that can describe a hotel. It should have members that include the name, address,
grade, average room charge, and number of rooms. Write functions to perform the following
operations.
- To print out hotels of a given grade in order of charges.
- To print out hotels with room charges less than a given value.
4. Create a structure called library to hold accession number, title of the book, author name, price of
the book, and flag indicating whether book is issued or not. Write a menu driven program that
depicts the working of a library. The menu options should be:
1. Add book information
2. Display book information
3. List all books of given author
4. List the title of specified book
5. List total no. of books in the library
6. List the books in the order of accession number
7. Exit
5. Write a function called leap() that receives the year as a parameter and returns 0 if it is a leap year,
otherwise it returns 1.
6. Write a function to calculate sum of digits in the number N.
7. Write a function to check whether a given number is prime number or not
8. Write a function to check whether a given number is Armstrong number or not.
9. Write a function to display return factorial of integer n.
[Link] a function to sort 1D array in ascending & descending order.
11. Write a function to sort 2D array in ascending & descending order.
12. Write a function to find the largest & the Smallest of 1 D array.
13. Write a function to find the largest & the smallest element of 2 D array.
14. Write a function that takes your birth date as input and display your age in terms year, month and
days.(Use Structure for date)
[Link] a function to validate date given by user. The function returns 0 for valid date and returns 1
otherwise.
16. Write a function that compares two given dates. If the dates are equal then it must return 0 else
return 1. (Use Structure for date)
17. Define a structure data type called time containing three members hour, minute, second. Develop a
UDF for following task:
a. create a function Input() to take input of the time from the user.
b. Create a function Display() to display the time entered by user.
c. Create a function Validate() that accepts one argument of time type
and return 0 if it is a valid, otherwise it returns 1.
18. Write a function to count total number of elements that hold prime numbers in two dimensional array.
19. Write a function to generate Fibonacci series up to N.
20. Write a function to calculate sum of digits in the number N.
21. Write a function to calculate a sum of all elements in two dimensional array.
22. Write a function to check whether a given number is prime or not.
23. Write a function to check whether a given number is Armstrong number or not.
24. Write a modular program that will perform the following tasks:
I.a Read two integer arrays with unsorted elements
I.b Sort them in ascending order
I.c Merge the sorted arrays
I.d Print the sorted list
Use functions for carrying out each of the above tasks. The main function should have only function calls.
24. Write a function to generate following pattern.
For e.g N=5
25. Write a function to print following pattern for number N.
For e.g N=5
26 Write user defined function to calculate factorial of a given number using recursion.
27 Write user defined function to print Fibonacci series using recursion
28 Write user defined function to multiply two integers using recursion.
29 Write user defined function to add number up to N using recursion
30 Write user defined function calculate power of number n using recursion.