top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How do I find the minimum value in an array using recursion in C language?

0 votes
33 views
How do I find the minimum value in an array using recursion in C language?
posted Oct 3 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes
#indlude<stdio.h>
#define MAX_ARRAY_LENGTH 5

int minimum = 0;

void find_minimum(int arr[], int index)
{
    if(index< MAX_ARRAY_LENGTH) {
        if(arr[index]<minimum)
            minimum=arr[index];
        find_minimum(arr,++index);
    }
}

int main()
{
    int arr[MAX_ARRAY_LENGTH] = {1,2,-9,-20,43};
    find_minimum(arr,0);
    printf("minimum = %d\n", minimum);
}
answer Nov 21 by Chirag Gangdev
Similar Questions
+4 votes

Addition to this,

Can we consider "a car a man a maraca" as palindrome string?
Click here To see similar kind of palindrome strings,
Are they really a palindrome?

+1 vote

Write a recursive function:

int sum( int x, int max ) 
{ 
  /* complete the code */ 
} 

that calculates the sum of the numbers from x to max (inclusive). For example, sum (4, 7) would compute 4 + 5 + 6 + 7 and return the value 22.

Note: The function must be recursive.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...