This repository hosts a collection of exercises designed for undergraduate students focusing on data structures and algorithms. The solutions to these exercises are implemented in the C programming language.
Those exercises are designed for beginners who are learning Data Structures and Algorithms. The solutions of the exercises are written in C programming language.
Write a C program that prompts users to input their blood type, calculates the frequency and percentage for each blood type, and then display the results along with the total population. The program should exit when the user inputs 'q'.
click on this link to see the solution of the exercise.
Two players roll a die. The player with the highest result scores a point. The game stops when one of the players reaches a score of 11. Simulate this game with a C program.
click on this link to see the solution of the exercise
Write a C program to display the first N prime numbers. Example N = 5, the first 5 prime numbers are {2, 3, 5, 7, 11}
click on this link to see the solution of the exercise.
Write a C program that prompts the user to input 2 integer numbers, then it calculates their greatest common divisor, and display the results.
click on this link to see the solution of the exercise.
Write a C program to sort an array of integers of length N in ascending and descending order.
click on this link to see the solution of the exercise.
Write a C program that prompts the user to input an integer value, and subsequently checks whether the entered value exists in the array of integers named 'Array'.
click on this link to see the solution of the exercise.
Write a C program that reverses an array of integers. Example: input: [1,2,3,4,5]. output: [5,4,3,2,1].
click on this link to see the solution of the exercise.
Write a C program that reads the dimension N of an array T of type int (maximum dimension 50) and allows you to:
click on this link to see the solution of the exercise.
$$\begin{bmatrix} a & b\ c & d\ \end{bmatrix} + \begin{bmatrix} e & f\ g & h\ \end{bmatrix} = \begin{bmatrix} a+e & b+f\ c+g & d+h\ \end{bmatrix} $$
click on this link to see the solution of the exercise.
Write a program that reads a line of text (not exceeding 200 characters), stores it in a variable TXT, and then displays:
Example:
Original: "voici une petite phrase !".
Reversed: "! esarhp etitep enu iciov".
click on this link to see the solution of the exercise.
Describe the matchstick game: initially, there is a pile of n matchsticks. (players specify the number of matchsticks to start the game)
Discription:
In the context of this university project, students are invited to develop a system for managing patient information for a hospital, using the C programming language. The focus is on the precise handling of medical and hospital details, with an approach that values the structuring and organization of data.
Objective:
The main objective of the project is to design a system that not only stores but also effectively manages patient information. This system will need to include details of prescribed treatments, any drug allergies, hospitalization data, as well as personal information of the patients.
Project Specifications:
To achieve this, students will need to create and use custom data structures in C. These structures should cover various aspects:
Key functionalities:
Key functionalities to be developed in this system include the ability to fully enter patient data, search for patients by their name, first name, or file number, and display detailed information about these patients.
Important considerations:
Important considerations for this project are the need to rigorously validate entries to ensure data accuracy. Moreover, it is essential that the code is well structured, clearly commented, and designed to be easy to understand and maintain. This project will offer students a valuable opportunity to develop their structured programming skills, while addressing a practical and relevant subject in the field of healthcare.
Note: “Clarity is the key to efficiency in programming.”
Write a program in C to find the square of any number using the function.
Test Data :
Input any number for square : 20
Expected Output :
The square of 20 is : 400.00
Write a program in C to swap two numbers using a function.
Test Data :
Input 1st number : 2 Input 2nd number : 4
Expected Output :
Before swapping: n1 = 2, n2 = 4 After swapping: n1 = 4, n2 = 2
Write a program in C to check if a given number is even or odd using the function.
Test Data :
Input any number : 5
Expected Output :
The entered number is odd.
Write a program in C to convert a decimal number to a binary number using the function.
Test Data :
Input any decimal number : 65
Expected Output :
The Binary value is : 1000001
Write a program in C to print the first 50 natural numbers using recursion.
Expected Output:
The natural numbers are : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
Write a program in C to print the Fibonacci Series using recursion. >
Test Data :
Input number of terms for the Series (< 20) : 10
Expected Output:
Input number of terms for the Series (< 20) : 10
The Series are : 1 1 2 3 5 8 13 21 34 55