Largest number in array using Recursion
Write a C Program to find largest number in array using Recursion. Here’s simple Program to find largest number in array using Recursion in C Programming Language.
Recursion : :
- Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function.
- The C programming language supports recursion, i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go into an infinite loop.
- Recursive functions are very useful to solve many mathematical problems, such as calculating the factorial of a number, generating Fibonacci series, etc.
Problem : :
This C Program prints the largest number in an unsorted array of elements using recursion. The array used here is of type integer.
Here is the source code of the C Program to find largest number in array using Recursion. The C Program is successfully compiled and run on a Linux system. The program output is also shown below.
SOURCE CODE : :
/* C Program to find largest number in array using Recursion */
int large(int, int, int);
printf("Enter size of the list :: ");
printf("\nPrinting the list :: \n\n");
for (i = 0; i < size ; i++)
list[i] = rand() % size;
if (size == 0)
largest = list;
largest = large(list, size - 1, largest);
printf("\n\nThe largest number in the list is :: %d \n", largest);
int large(int list, int size, int largest)
if (size == 1)
if (size > -1)
if (list[size] > largest)
largest = list[size];
return(largest = large(list, size - 1, largest));
Output : :
/* C Program to find largest number in an array using Recursion */
Enter size of the list :: 10
Printing the list ::
1 7 4 0 9 4 8 8 2 4
The largest number in the list is :: 9
Process returned 0
Above is the source code for C Program to find largest number in array using Recursion which is successfully compiled and run on Windows System.The Output of the program is shown above .
If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.
Thanks for reading the post….