This repository contains the coursework assignments for CSC121 at the University of Lagos. Each C program included here serves a unique purpose, demonstrating fundamental concepts in C programming.
This program calculates the value of Pi using a specified number of iterations of a series.
This program calculates carpool savings by taking into account factors like distance traveled, fuel cost, and car efficiency.
This program tests various conditional statements and demonstrates their usage in different scenarios.
This program separates the digits of an integer and prints each digit on a new line.
This program checks if a number is even or odd.
This program demonstrates the usage of increment and decrement operators.
This program checks if a given number is a prime number.
This program prints all prime numbers up to a specified limit.
This program calculates the sum of multiples of a specified number up to a given limit.
This program calculates the area of a triangle given its base and height.
To run these programs, you need to have a C compiler installed on your system. You can use GCC, which is available for most operating systems.
- Clone the repository:
git clone https://github.com/your-username/CSC121-coursework.git
- Navigate to the repository directory:
cd CSC121-coursework
To compile any of the C programs, use the following command:
gcc -o output_name source_file.c
# For example, to compile calculate-pi.c, you would use:
gcc -o calculate-pi calculate-pi.c
To run the compiled program, use the following command:
./output_name
# For example, to run the compiled calculate-pi program, you would use:
./calculate-pi
This project is licensed under the MIT License - see the LICENSE file for details.