From 2d9d44688e781cc2a41bdecb5b5897c9475cf7b7 Mon Sep 17 00:00:00 2001 From: arijeet1998 <49070803+arijeet1998@users.noreply.github.com> Date: Wed, 23 Oct 2019 00:32:21 +0530 Subject: [PATCH] Update max_min.c --- max_min.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/max_min.c b/max_min.c index 017550c..e5d0451 100644 --- a/max_min.c +++ b/max_min.c @@ -1,5 +1,4 @@ #include -#include void gl(int x,int y,int z) { int g,l; @@ -25,13 +24,26 @@ void gl(int x,int y,int z) else if(z>x && z>y) g=z; printf("\nGreatest and lowest number are %d,%d",g,l); - } + } +void max(int a,int b,int c) +{ + if(a>b) + { + if(a>c) + return a; + } + else if(b>c) + return b; + else + return c; + -main() +int main() { int a,b,c; printf("Enter three number : "); scanf("%d%d%d",&a,&b,&c); gl(a,b,c); - getch(); -} \ No newline at end of file + printf("%d",max(a,b,c)); + return 0; +}