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 = 5Expected Output:
Area = 78.54Code In C
Run Code?
Click Run Button to view compiled output
2. Calculate the perimeter of a rectangle.
Required Input:
length = 10, width = 5Expected Output:
Perimeter = 30Code In C
Run Code?
Click Run Button to view compiled output
3. Calculate the average of three numbers.
Required Input:
num1 = 7, num2 = 13, num3 = 19Expected Output:
Average = 13.0Code In C
Run Code?
Click Run Button to view compiled output
4. Check if a number is even or odd.
Required Input:
number = 42Expected Output:
EvenCode In C
Run Code?
Click Run Button to view compiled output
5. Find the larger of two numbers.
Required Input:
num1 = 5, num2 = 10Expected Output:
Larger number = 10Code In C
Run Code?
Click Run Button to view compiled output
6. Find the factorial of a number.
Required Input:
number = 5Expected Output:
Factorial = 120Code In C
Run Code?
Click Run Button to view compiled output
7. Reverse a three-digit number.
Required Input:
number = 123Expected Output:
Reversed = 321Code In C
Run Code?
Click Run Button to view compiled output
8. Find the sum of digits of a three-digit number.
Required Input:
number = 345Expected Output:
Sum = 12Code In C
Run Code?
Click Run Button to view compiled output
9. Convert Celsius to Fahrenheit.
Required Input:
celsius = 25Expected Output:
Fahrenheit = 77.0Code In C
Run Code?
Click Run Button to view compiled output
10. Find the smallest of three numbers.
Required Input:
a = 5, b = 3, c = 9Expected Output:
Smallest = 3Code In C
Run Code?
Click Run Button to view compiled output


