0% found this document useful (0 votes)
39 views3 pages

?C Programming - 40 Practice Problems From Easy To Hard.?

Uploaded by

jhakumardeepakk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

?C Programming - 40 Practice Problems From Easy To Hard.?

Uploaded by

jhakumardeepakk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

■■ EASY LEVEL

1. Check whether a number is positive, negative, or zero.


Description: Determine the sign of the number using conditional statements.

2. Check whether a number is even or odd.


Description: Check divisibility by 2 to classify as even or odd.

3. Find the largest of two numbers.


Description: Compare both values and print the greater one.

4. Calculate the sum of the first N natural numbers.


Description: Add all natural numbers from 1 to N using a loop.

5. Reverse a given number.


Description: Reverse the number by extracting digits using modulus.

6. Check whether a number is a palindrome.


Description: Compare the original number with its reversed form.

7. Count the number of digits in a number.


Description: Count digits by repeatedly dividing the number by 10.

8. Calculate the sum of the digits of a number.


Description: Sum digits extracted using modulus and division operations.

9. Check whether a character is a vowel or a consonant.


Description: Check if character matches any vowel; otherwise consonant.

10. Display the multiplication table of a given number.


Description: Multiply number from 1 to 10 in a loop.

11. Convert Celsius temperature to Fahrenheit.


Description: Use conversion formula Fahrenheit = (C × 9/5) + 32.

12. Display the Fibonacci series up to N terms.


Description: Generate numbers where each term is the sum of previous two.

13. Find the factorial of a number.


Description: Multiply numbers from 1 to N to compute factorial.

14. Check whether a number is prime.


Description: Check divisibility up to square root of the number.

15. Find the GCD of two numbers.


Description: Find highest common factor using mathematical checks.
■■ MEDIUM LEVEL

1. Count prime numbers within a given range.


Description: Loop through the range and check prime for each number.

2. Check whether a number is an Armstrong number.


Description: Check if sum of powered digits equals the number.

3. Find the largest and smallest digits in a number.


Description: Extract digits and track smallest and largest.

4. Convert a decimal number to binary.


Description: Perform repeated division by 2 and collect remainders.

5. Convert a binary number to decimal.


Description: Multiply each binary digit by 2 powered to its position.

6. Count the frequency of each digit in a number.


Description: Use an array to store and count each digit occurrence.

7. Find the second largest element in an array.


Description: Track first and second highest values while iterating.

8. Remove duplicate elements from an array.


Description: Skip storing values that appear more than once.

9. Sort the elements of an array in ascending order.


Description: Compare and swap elements using sorting algorithms.

10. Perform a linear search in an array.


Description: Compare key with elements sequentially.

11. Compare two strings without using strcmp().


Description: Check characters one-by-one until mismatch.

12. Reverse a string without using strrev().


Description: Print characters from end to start.

13. Perform matrix addition.


Description: Add elements at matching positions of matrices.

14. Find the transpose of a matrix.


Description: Interchange rows and columns.

15. Count vowels and consonants in a string.


Description: Iterate characters and classify vowel/consonant.
■■ HARD LEVEL

1. Perform matrix multiplication.


Description: Multiply rows and columns from two matrices.

2. Check whether a number is automorphic.


Description: Check if the square's last digits match the number.

3. Check whether a number is perfect, abundant, or harshad.


Description: Calculate sums of factors or digits to classify number.

4. Find the prime factorization of a number.


Description: Repeatedly divide by prime numbers to extract factors.

5. Check whether two numbers are friendly pairs.


Description: Compare divisor-sum ratios of both numbers.

6. Find the longest substring without repeating characters.


Description: Track longest substring while avoiding repeated characters.

7. Implement binary search using recursion.


Description: Divide search by comparing mid element and recurse.

8. Find all Armstrong numbers within a range.


Description: Check armstrong condition for each number in range.

9. Generate a 3×3 magic square.


Description: Arrange numbers so rows, columns, diagonals match sum.

10. Solve the N-Queens problem (4×4).


Description: Place queens avoiding attacks in rows, columns, diagonals.

You might also like