# C Programming Code Examples

## C > Functions Code Examples

C Language program code add two Complex numbers by passing structure to a function. In this program code, structures j1 and j2 are passed as an argument of function add(). The

Program input a number from user and check whether given number is Even or Odd using functions. Declare function to find even odd. First give a meaningful name to our function,

Recursive function in C to Check Palindrome number. Declare recursive function to check palindrome. First give a meaningful name to our function, say isPalindrome(). Along with

C First give a meaningful name to our prime checking function say isPrime() function will check a number for prime. Since our function checks a number for prime condition. Hence

C Program code input any number from user and find cube of the a number using function. Lets assign meaningful name to the function, say cube(). Function should accept a number

C Functions to find Diameter, Circumference and Area of circle. First assign a meaningful name to all the three functions. Say function to calculate diameter, circumference & area

Declare recursive function to find factorial of a number. First let us give a meaningful name to our function, say fact(). Factorial Function accepts an integer input whose factorial is to

Recursive function in C language to find GCD (HCF) of two numbers. Find GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor ) of two numbers using recursion in C

C Program to find LCM of two numbers using recursion. Initialize multiple variable with the maximum value among two given numbers. Check whether multiple clearly divides both

How to find maximum and minimum element in an array using recursion in C programming. Recursion works on the concept of divide and conquer. We break the problem in its smallest

First give a meaningful name to our function. Say max() function is used to find maximum between two numbers. Second, we need to find maximum between two numbers. And

First give a meaningful name to our recursive function say pow(). The function must accept 2 numbers i.e. base. exponent and calculate its power. Hence, take 2 parameters for base

Declare function to find all prime numbers in given range. First give a meaningful name to our function. Say printPrimes() function will print all prime numbers in a range. Declare...

Declare recursive function to find reverse of a number. Lets give a meaningful name to our function, say reverse(). C function computes reverse of number, hence it must accept an...

Find Sum of Array elements Using Recursive function in C language. Function declaration to find sum of array. Input size and elements in array. Recursively find the sum of elements

Write a Recursive Function in C Language to calculate sum of digits of a number. Declare Recursive Function to find sum of digits of a number. First give a meaningful name to the

C Code declare recursive function to find sum of even number. Lets give a meaningful name to our function, say "sumOfEvenOdd()". Next the function accepts two integer values from

Give a meaningful name to the function, say sumOfNaturalNumbers(). The function must accept two inputs i.e. the lower & upper limit to find sum. Pass two integer parameters to

C Code Declare recursive function to find nth Fibonacci term. Assign a meaningful name to the function, say fibo(). The function accepts an integer hence update function declaration

Declare function to print Armstrong numbers in given range. Lets give a meaningful name to function. Say "printArmstrong()" function prints all Armstrong numbers in given range.

Declare c recursive function to print natural numbers in a range. Lets give a meaningful name to function, "printNaturalNumbers()". Next we need to print Natural Numbers in...

First give a meaningful name to our function, say "printStrongNumbers()". Along with this we must define function to find factorial of a number, say long long fact(int x);. Next we...

Define our Recursive Function to print array elements & say printArray(int arr[], int start, int len). The function takes three parameters where first is array to print, second is starting

First give a meaningful name to the recursive function to print even odd numbers. Let's say printEvenOdd(). This function can print both even as well as Odd Numbers in given range.

Declare function to print all Perfect Numbers in given range. First give meaningful name to the function. Say "printPerfect()" will print all perfect numbers in given range. Along with...

How to declare a function pointer and how to call a function using this pointer in C. We can have concept of Pointer to a function known as function pointer in C. In this C tutorial, we

Page 1 Page 2