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 does the message "automatic aggregate intialization is an ansi feature" mean?
Explain enumerated types.
what is event driven software and what is procedural driven software?
How do you sort filenames in a directory?
Write a program to implement queue.
What is p in text message?
When can a far pointer be used?
How can my program discover the complete pathname to the executable from which it was invoked?
What are data structures in c and how to use them?
How many loops are there in c?
What does %d do?
What does volatile do?
What is the difference between void main and main in c?
code for find determinent of amatrix
What is identifiers in c with examples?