Skip to content

areekaraza/C-programming-collection

Repository files navigation

C Programming Practice Collection

A comprehensive collection of C programming exercises and projects covering fundamental concepts like arrays, patterns, calculations, and user input handling.

Repository Contents

Array Operations

  • 2D_Array_1.c - 2D array manipulation and sorting
  • Assignment-3.c - Complex 2D array operations with pointers

Pattern Programs

  • Pattern_1.c - Star pattern triangle
  • Pattern_1a.c - Number pattern with odd numbers
  • Half_Diamond.c - Half diamond star pattern
  • full_daimond.c - Complete diamond pattern
  • right_half_diamond.c - Right-aligned diamond pattern

Mathematical Operations

  • arith operations.c - Basic arithmetic calculator (addition, subtraction, multiplication, division)
  • calculator c.c - Interactive calculator program
  • Prime_Factors.c - Prime factorization of numbers
  • Sum of Integers.c - Sum calculation for positive/negative integers

User Classification Programs

  • Age.c - Age-based classification (baby, child, adult)
  • grading.c - Grade classification based on percentage
  • height.c - Height-based classification (short, average, tall, very tall)
  • Human_Height.c - Statistical analysis of multiple height inputs

Utility Programs

  • 35_marker.c - Mathematical expression evaluation
  • 50_Marker.c - Number sequence operations
  • Functions_1.c - Function demonstration program
  • test.c - Simple "Hello, World!" program

Getting Started

Prerequisites

  • GCC compiler installed on your system
  • Basic understanding of C programming

Compilation and Execution

Option 1: Run All Programs (Automated)

# Make the script executable
chmod +x run_all.sh

# Run all programs
./run_all.sh

Option 2: Compile Individual Programs

# Compile a specific program
gcc filename.c -o output_name

# Run the compiled program
./output_name

Examples:

# Compile and run the calculator
gcc "arith operations.c" -o calculator
./calculator

# Compile and run pattern programs
gcc Pattern_1.c -o pattern
./pattern

# Compile and run age classifier
gcc Age.c -o age_classifier
./age_classifier

Features

  • Cross-platform compatibility - All programs work on Linux, macOS, and Windows
  • Clean code structure - Following C programming best practices
  • Interactive programs - Several programs accept user input
  • Educational value - Perfect for learning C programming fundamentals

Program Categories

Category Programs Description
Patterns Pattern_1.c, Pattern_1a.c, Half_Diamond.c, full_daimond.c, right_half_diamond.c Various star and number patterns
Arrays 2D_Array_1.c, Assignment-3.c 2D array operations and pointer manipulation
Math arith operations.c, calculator c.c, Prime_Factors.c, Sum of Integers.c Mathematical calculations and algorithms
Classification Age.c, grading.c, height.c, Human_Height.c User input classification systems
Utilities 35_marker.c, 50_Marker.c, Functions_1.c, test.c Helper and demonstration programs

Sample Outputs

Pattern Examples:

Diamond Pattern:
   *
  ***
 *****
*******
 *****
  ***
   *

Number Pattern:
1  
1  3  
1  3  5  
1  3  5  7  

Calculator Example:

Please Enter Two Numbers: 10 5

Sum =  15.00
Difference =   5.00
Product =  50.00
Quotient =   2.00

Grade Classification:

PLEASE ENTER PERCENTAGE: 85

B+

Code Quality

  • All programs compile without warnings
  • Memory-safe operations
  • Proper input validation where applicable
  • Clean, readable code structure
  • Standard C library usage only

Contributing

Feel free to:

  • Add new programs
  • Improve existing code
  • Fix bugs or issues
  • Enhance documentation

License

This project is open source and available under the MIT License.

Development Environment

  • Language: C (C99 standard)
  • Compiler: GCC
  • Platform: Cross-platform (Linux, Windows, macOS)
  • Tools: Git for version control

Repository Statistics

  • Total Programs: 19
  • Lines of Code: ~500+
  • Categories: 5
  • All Programs: Tested and Working

*Happy Coding! *

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors