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
Is null always equal to 0(zero)?
What is the difference between union and anonymous union?
What is a program?
What is the best way to comment out a section of code that contains comments?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What does the file stdio.h contain?
Explain about block scope in c?
Differentiate between calloc and malloc.
What is the difference between text and binary modes?
What is a dynamic array in c?
What is the difference between printf and scanf )?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
How are strings stored in c?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
What is the use of ?: Operator?