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 register a keyword in c?
How can you invoke another program from within a C program?
What is local and global variable in c?
What are the types of functions in c?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
How can I remove the leading spaces from a string?
Do pointers store the address of value or the actual value of a variable?
What is malloc and calloc?
Why c is called a mid level programming language?
Explain indirection?
What are the application of void data type in c?
what is ur strangth & weekness
What is data structure in c and its types?
What is pointers in c with example?
Why is C language being considered a middle level language?