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
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers
What is cohesion in c?
What are the 3 types of structures?
How can you pass an array to a function by value?
How can I copy just a portion of a string?
Is c easier than java?
Why dont c comments nest?
Is calloc better than malloc?
Explain what happens if you free a pointer twice?
What is meant by recursion?
Explain can static variables be declared in a header file?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
Can we declare variable anywhere in c?
What is the benefit of using an enum rather than a #define constant?
main() { printf("hello"); fork(); }