C Programs
发布时间:2026-08-31 | 浏览:1
Interview Questions
Practicing and solving problems is essential for learning C programming effectively. These examples help build programming skills and prepare for common C programming problems.
Includes over 100 C programming examples covering basics, strings, arrays, pointers, conversions, pattern printing, and more.
Covers problems from fundamental to advanced concepts, including questions frequently asked in C programming interviews.
These basic C programs help beginners understand fundamental concepts such as input, output, variables, arithmetic operations, and basic calculations.
Hello World Program
Print Your Own Name
Print an Integer Entered By the User
Add Two Numbers
Check Whether a Number is Prime or Not
Multiply two Floating-Point Numbers
Print the ASCII Value of a Character
Swap Two Numbers
Calculate Fahrenheit to Celsius
Find the Size of int, float, double, and char
Add Two Complex Numbers
Print Prime Numbers From 1 to N
Find Simple Interest
Find Compound Interest
Area And Perimeter Of Rectangle
These C programs cover decision-making and looping concepts such as if-else, switch, for, while, and do-while loops.
Check Whether a Number is Positive, Negative, or Zero
Check Whether Number is Even or Odd
Check Whether a Character is Vowel or Consonant
Find Largest Number Among Three Numbers
Calculate Sum of Natural Numbers
Print Alphabets From A to Z Using Loop
Check Leap Year
Find Factorial of a Number
Make a Simple Calculator
Generate Multiplication Table
Print Fibonacci Series
Find LCM of Two Numbers
Check Armstrong Number
Display Armstrong Numbers Between 1 to 1000
Display Armstrong Number Between Two Intervals
Reverse a Number
Check Whether a Number is a Palindrome or Not
Check Whether a Number is Prime or Not
Display Prime Numbers Between Intervals
Check whether the input number is a Neon Number
Find All Factors of a Natural Number
Sum of Fibonacci Numbers at Even Indexes up to N Terms
Pattern Printing
These C programs demonstrate how to use nested loops to print different star, number, and character patterns.
Print Simple Pyramid Pattern
Print Given Triangle
Print 180 0 Rotation of Simple Pyramid
Print Inverted Pyramid
Print Number Pattern
Print Character Pattern
Print Continuous Character Pattern
Print Hollow Star Pyramid
Print Inverted Hollow Star pyramid
Print Hollow Star Pyramid in a Diamond Shape
Print Full Diamond Shape Pyramid
Print Pascal's Pattern Triangle Pyramid
Print Floyd's Pattern Triangle Pyramid
Print Reverse Floyd pattern Triangle Pyramid
These C programs demonstrate how to define and use functions, pass arguments, return values, and apply recursion in C.
Check Prime Number By Creating a Function
Display Prime Numbers Between Two Intervals Using Functions
Find All Roots of a Quadratic Equation
Check Whether a Number can be Express as Sum of Two Prime Numbers
Find the Sum of Natural Numbers using Recursion
Calculate the Factorial of a Number Using Recursion
Find G.C.D Using Recursion
Reverse a Stack using Recursion
Calculate Power Using Recursion
These C programs cover common operations on one-dimensional and two-dimensional arrays, including searching, sorting, and matrix operations.
Print a 2D Array
Find the Largest Element in an Array
Find the Maximum and Minimum in an Array
Search an Element in an Array (Binary search)
Calculate the Average of All the Elements Present in an Array
Sort an Array using Bubble Sort
Sort an Array using Merge Sort
Sort an Array Using Selection Sort
Sort an Array Using Insertion Sort
Sort the Elements of an Array in Descending Order
Sort the Elements of an Array in Ascending Order
Remove Duplicate Elements From a Sorted Array
Merge Two Arrays
Remove All Occurrences of an Element in an Array
Find Common Array Elements
Copy All the Elements of One Array to Another Array
Sort the 2D Array Across Rows
Check Whether Two Matrices Are Equal or Not
Find the Transpose
Find the Determinant of a Matrix
Find the Normal and Trace
Add Two Matrices
Multiply Two Matrices
Print Boundary Elements of a Matrix
Rotate Matrix Elements
Compute the Sum of Diagonals of a Matrix
Interchange Elements of First and Last in a Matrix Across Rows
Interchange Elements of First and Last in a Matrix Across Columns
These C programs demonstrate common string operations such as concatenation, comparison, reversal, searching, and manipulation.
Add or Concatenate Two Strings
Add 2 Binary Strings
Get a Non-Repeating Character From the Given String
check if the string is palindrome or not
Reverse an Array or String
Reverse a String Using Recursion
Find the Length of a String
Check For Pangram String
Print the First Letter of Each Word
Determine the Unicode Code Point at a Given Index
Remove Leading Zeros
Compare Two Strings
Compare Two Strings Lexicographically
Insert a String into Another String
Split a String into a Number of Sub-Strings
These C programs cover conversions between different data types and number systems, such as binary, decimal, octal, hexadecimal, and strings.
Boolean to String Conversion
Float to String Conversion
Double to String Conversion
String to Long Conversion
Long to String Conversion
Int to Char Conversion
Char to Int Conversion
Octal to Decimal Conversion
Decimal to Octal Conversion
Hexadecimal to Decimal Conversion
Decimal to Hexadecimal Conversion
Decimal to Binary Conversion
Binary to Decimal Conversion
These C programs demonstrate the use of pointers for accessing, modifying, and manipulating data stored in memory.
How to Return a Pointer from a Function in C
How to Declare a Two-Dimensional Array of Pointers in C?
Find the Largest Element in an Array using Pointers
Swap Two Numbers
Sort an Array using Pointers
Sort a 2D Array of Strings
Check if a String is a Palindrome using Pointers
Create a Copy of a Singly Linked List using Recursion
Structures and Unions
These C programs demonstrate how structures and unions can be used to group and manage different types of related data.
Store Information of Students Using Structure
Store Student Records as Structures and Sort them by Name
Add N Distances Given in inch-feet System using Structures
Add Two Complex Numbers by Passing Structure to a Function
Store Student Records as Structures and Sort them by Age or ID
Read/Write Structure to a File in C
Flexible Array Members in a Structure in C
These C programs cover file handling operations such as creating, reading, writing, copying, renaming, and comparing files.
Create a Temporary File
Read/Write Structure to a File
Make a File Read-Only
Compare Two Files and Report Mismatches
Copy One File into Another File
Print all the Patterns that Match Given Pattern From a File
Append the Content of One Text File to Another
Read Content From One File and Write it Into Another File
Read and Print all Files From a Zip File
These C programs demonstrate how to work with dates and times, including formatting, conversion, and displaying the current date and time.
Format time in AM-PM format
Print Digital Clock with the Current Time
Display Dates of Calendar Year in Different Formats
Display Current Date and Time
Maximize Time by Replacing ‘_’ in a Given 24-Hour Format Time
Convert the Local Time to GMT
Convert Hours into Minutes and Seconds
More C Programs
This section contains additional C programs covering errors, mathematical operations, graphics, source code manipulation, and other useful programming problems.
Show Runtime exceptions
Show Types of errors
Show Unreachable Code Error
Find Quotient and Remainder
Find the Initials of a Name
Draw a Circle in Graphics
Printing Source Code of a C Program Itself
Introduction 3 min read
Identifiers 3 min read
Keywords 3 min read
Variables 4 min read
Data Types 4 min read
Operators 8 min read
Conditional Statements 4 min read
Loops 6 min read
Functions 4 min read
Arrays 4 min read
Strings 5 min read
Pointers 7 min read
Function Pointer 5 min read
Unions 3 min read
Enumeration 4 min read
Structure Alignment, Padding & Data Packing 5 min read
Memory Layout 5 min read
Dynamic Memory Allocation 7 min read
Memory Leak 3 min read
File Handling 11 min read
Read/Write Structures 4 min read
Error Handling 5 min read
Using goto for Exception Handling in C 2 min read
File Error Handling 5 min read
Variadic Functions 4 min read
Signals in C 4 min read
Socket Programming 8 min read
_Generics Keyword 3 min read
Multithreading 4 min read
Placement 360 Course 2 min read
DSA and System Design Course 2 min read