C Programming Assignment Experiments
This repository contains a collection of C programs written for a programming assignment. The programs are simple, well-commented, and designed to demonstrate fundamental C programming concepts for beginners.
The experiments are organized into five sets, covering the following topics:
Topics Covered
Experiment Set 1: Basic C Programs
Printing "Hello World"
Variables, data types, and memory addresses
Basic input/output with printf() and scanf()
Simple arithmetic and the modulo operator (sum of digits)
Storing and displaying simple records (Product, Book, Mobile Phone info)
Experiment Set 2: Control Statements and Operators
for and while loops (multiples of 3 or 5)
if...else if...else logic (quadratic roots, largest of three)
Modulo operator for logic (even/odd)
Ternary operator
Common algorithms (Palindrome, Armstrong, Fibonacci)
Nested loops for pattern printing
switch statements (simple calculator)
Demonstrations of all C operators (Logical, Bitwise, Assignment, etc.)
Experiment Set 3: Functions
Creating and using functions
Parameters and return values (area of a circle)
void functions (displaying data)
Using pointers to modify variables from a function (employee data entry)
Using global variables to maintain state (simple banking system)
Experiment Set 4: Arrays
Single-dimensional arrays (finding second largest, counting elements)
Iterating through arrays to analyze data (positive/negative/odd/even)
Searching in an array (frequency of a number)
Two-dimensional arrays (matrix multiplication)
Experiment Set 5: Variables and Scope
Global Scope: Understanding variables accessible to all functions.
Local Scope: Understanding variables private to a single function.
Block Scope: Understanding variables local to a specific if statement or loop.
How to Compile and Run
Each program is a standalone .c file. You can compile and run any of them using a C compiler like gcc (GNU C Compiler).
Open your terminal or command prompt.
Navigate to the directory containing the file you want to run.
Compile the program (e.g., program_to_add.c):
gcc program_to_add.c -o program_to_add
Run the compiled executable:
./program_to_add