Find greatest number out of 10 number without using loop.
Answer Posted / ashwin
#include<stdio.h>
int MAX(int a,int b)
{
if(a>b)
return a;
else
return b;
}
int max(int a[],int n)
{
if(n==1)
return a[0];
else
return MAX(a[n-1],max(a,n-1));
}
int main()
{
int a[]={3,5,1,5,7,3,9,0,2,6};
int n=10,big;
big=max(a,n);
printf("%d",big);
return 0;
}
Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
What is "Duff's Device"?
What is a pointer on a pointer in c programming language?
Explain how do you list files in a directory?
What is the value of h?
List some applications of c programming language?
What are global variables and how do you declare them?
what type of questions arrive in interview over c programming?
Define the scope of static variables.
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
explain what are actual arguments?
What is exit() function?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What is the difference between arrays and pointers?
Where are some collections of useful code fragments and examples?
How many bytes is a struct in c?