30 C Programming Basic Exercises for Beginners with Solutions
Master beginner C Programming skills with our comprehensive list of top 30 exercises. Dive into coding challenges that improve your understanding and proficiency in C Programming, setting a solid foundation for intermediate challenges. Start your journey to C Programming mastery today!
Learning Objectives:
By the end of these exercises, you will have a foundational understanding of C language basics, including variables, data types, control flow, and simple functions.
Exercise Instructions:
- Start with the first exercise and attempt to solve it before checking the hint or solution.
- Ensure you understand the logic behind each solution, as this will help you in more complex problems.
- Use these exercises to reinforce your learning and identify areas that may require further study.
1. Calculate the area of a circle.
Required Input:
radius = 5
Expected Output:
Area = 78.54
Code In C
Output
Click Run Button to view compiled output
2. Calculate the perimeter of a rectangle.
Required Input:
length = 10, width = 5
Expected Output:
Perimeter = 30
Code In C
Output
Click Run Button to view compiled output
3. Calculate the average of three numbers.
Required Input:
num1 = 7, num2 = 13, num3 = 19
Expected Output:
Average = 13.0
Code In C
Output
Click Run Button to view compiled output
4. Check if a number is even or odd.
Required Input:
number = 42
Expected Output:
Even
Code In C
Output
Click Run Button to view compiled output
5. Find the larger of two numbers.
Required Input:
num1 = 5, num2 = 10
Expected Output:
Larger number = 10
Code In C
Output
Click Run Button to view compiled output
6. Find the factorial of a number.
Required Input:
number = 5
Expected Output:
Factorial = 120
Code In C
Output
Click Run Button to view compiled output
7. Reverse a three-digit number.
Required Input:
number = 123
Expected Output:
Reversed = 321
Code In C
Output
Click Run Button to view compiled output
8. Find the sum of digits of a three-digit number.
Required Input:
number = 345
Expected Output:
Sum = 12
Code In C
Output
Click Run Button to view compiled output
9. Convert Celsius to Fahrenheit.
Required Input:
celsius = 25
Expected Output:
Fahrenheit = 77.0
Code In C
Output
Click Run Button to view compiled output
10. Find the smallest of three numbers.
Required Input:
a = 5, b = 3, c = 9
Expected Output:
Smallest = 3
Code In C
Output
Click Run Button to view compiled output