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 struct node * mean?
Can you pass an entire structure to functions?
How can you increase the size of a statically allocated array?
How can you find the day of the week given the date?
Why is event driven programming or procedural programming, better within specific scenario?
Is array a primitive data type in c?
What is sizeof int?
Write a program for finding factorial of a number.
What is the difference between arrays and pointers?
Explain how can I remove the trailing spaces from a string?
What is the difference between a function and a method in c?
what is the difference between class and unio?
What does a function declared as pascal do differently?
Do you know null pointer?
What is c system32 taskhostw exe?