Functions programming exercises and solutions in C

Functions in programming is a block of statements grouped together to perform some specific task. Functions provides modularity to our program which are easy to maintain, debug and understand. Functions in C programming can be classified in two category i.e. predefined or library functions and user defined functions. Below is a list of programming exercises based on functions and recursion to practice for beginners to advance their programming capabilities with functions. Here in this programming exercise we will mainly focus on user defined functions and recursion.

  1. Write a C program to find cube of any number using function.
  2. Write a C program to find diameter, circumference and area of circle using functions.
  3. Write a C program to find maximum and minimum between two numbers using functions.
  4. Write a C program to check whether a number is even or odd using functions.
  5. Write a C program to check whether a number is prime, Armstrong or perfect number using functions.
  6. Write a C program to find all prime numbers between given interval using functions.
  7. Write a C program to print all strong numbers between given interval using functions.
  8. Write a C program to print all armstrong numbers between given interval using functions.
  9. Write a C program to print all perfect numbers between given interval using functions.


  10. Write a C program to find power of any number using recursion.
  11. Write a C program to print all natural numbers between 1 to n using recursion.
  12. Write a C program to print all even or odd numbers in given range using recursion.
  13. Write a C program to find sum of all natural numbers between 1 to n using recursion.
  14. Write a C program to find sum of all even or odd numbers in given range using recursion.
  15. Write a C program to find reverse of any number using recursion.
  16. Write a C program to check whether a number is palindrome or not using recursion.
  17. Write a C program to find sum of digits of a given number using recursion.
  18. Write a C program to find factorial of any number using recursion.
  19. Write a C program to generate nth Fibonacci term using recursion.
  20. Write a C program to find GCD (HCF) of two numbers using recursion.
  21. Write a C program to find LCM of two numbers using recursion.


  22. Write a C program to display all array elements using recursion.
  23. Write a C program to find sum of elements of array using recursion.
  24. Write a C program to find maximum and minimum elements in array using recursion.

Happy coding ;)


Any doubt or suggestion write here. I will try my best to help. Before posting your code you must escape it to view. To format your source code and use format highlighting, post your source code inside
< code >< pre > -- Your source code -- < /pre >< /code > (Remove spaces from pre and code tags).

No comments:

Post a Comment