Maximum of three number using function

Program:

#include<stdio.h>
int maxthree(int,int,int);
int main()
{
int x,y,z,max;
printf("Enter three num: \n");
scanf("%d%d%d",&x,&y,&z);
max=maxthree(x,y,z);
printf("Maximum : %d",max);
    return 0;
}
int maxthree(int a,int b,int c)
{
   return ((a>b)?( ((a>c)?a:c)): ((b>c)?b:c) );
}

Output:



No comments:

Post a Comment

x^y using recursion

Program: #include<stdio.h> int power(int a,int b); int main() { int x,y,ans; printf("Enter x and y:\n "); scanf(...