Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Birla Institute of Technology & Science, Pilani Hyderabad Campus

Second Semester 2023-2024


Computer Programming [CS F111]
Lab 10 (Structures, Strings)

Q1. Write a C program where the user is asked to enter the start time and the stop time.
Store the two time periods in the structure variables (in hours, minutes and seconds format)
and pass them to the user defined function and calculate the time interval between them.

Output (next page):


Q2: Write a C program to take two complex numbers as structures and add them by
creating a user-defined function.

Output:

Q3. Write a C program that takes two strings as input and concatenates them in another
string and displays the concatenated string. Do not use strcat function from string.h file.
Write your own code to do this as shown below:
Output:

Q4. Write a C Program to reverse alternate characters of a string without using pointers
as shown below:
Output:

Extra Problem: Write a C program to create a structure named Date. The structure should have day,
month and year as inputs. Store the current date in the structure. Take inputs ‘x’ from the user where x
is the number of days. Add x to current date and display the final date. Also, consider leap years.

You might also like