Solve each problem first without looking at a solution. Use small test inputs and compile with warnings enabled.
- Print your name and three details on separate lines.
- Read two integers and print sum, difference, product and quotient (handle division by zero).
- Read radius and calculate circle area.
- Convert Celsius to Fahrenheit.
- Swap two values using a temporary variable.
- Check even or odd.
- Find the largest of three numbers.
- Check positive, negative or zero.
- Check leap year.
- Check whether a character is an uppercase letter, lowercase letter, digit or other character.
- Calculate grade using a clearly stated marks range.
- Build a calculator using
switch.
- Print 1 to N and N to 1.
- Print the multiplication table of N.
- Find sum of first N natural numbers.
- Find factorial.
- Count digits and find digit sum.
- Reverse a number.
- Check numeric palindrome.
- Check prime number.
- Print all primes in a range.
- Generate Fibonacci sequence.
- Solid square.
- Right triangle.
- Inverted right triangle.
- Number triangle.
- Multiplication grid.
- Hollow rectangle.
- Pyramid with centered stars.
- Function to return maximum of two numbers.
- Function to check prime.
- Recursive factorial.
- Recursive sum from 1 to N.
- Recursive sum of digits.
- Recursive Fibonacci; compare its performance with iteration.
- GCD using Euclid's algorithm.
- Find sum and average.
- Find minimum and maximum.
- Search for an element.
- Reverse an array in place.
- Find second-largest distinct value.
- Sort values in ascending order.
- Merge two arrays.
- Add and transpose matrices.
- Find length without
strlen. - Count vowels and consonants.
- Reverse a string.
- Check palindrome.
- Count words in a line.
- Copy a string without
strcpy. - Compare two strings without
strcmp. - Extract a substring using start and end indexes.
- Swap values using pointers.
- Traverse an array using pointer arithmetic.
- Create a
Studentstructure and display a record. - Store multiple records in an array of structures.
- Write text to a file and read it back.
- Append a record to a file.
- Count lines and characters in a file.
For a number-checking problem, test a negative number, zero, one, an ordinary positive number and a boundary value. For strings, test an empty string, one character, spaces, uppercase letters and repeated characters. For arrays, test one element, duplicate values, sorted values and reverse-sorted values.