Skip to content

Commit edaf9c1

Browse files
committed
Functions 2
1 parent 65b26bc commit edaf9c1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

This is c code/23.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//FInding the greatest of 3 numbers using functions
2+
#include<stdio.h>
3+
void compare(int,int,int); //Declaration
4+
int main(){
5+
int a,b,c;
6+
printf("Enter 3 numbers: ");
7+
scanf("%d%d%d",&a,&b,&c);
8+
compare(a,b,c); //Usage
9+
return 0 ;
10+
}
11+
void compare(int a,int b,int c){
12+
if(a>b&&a>c){
13+
printf("%d is greatest\n",a);
14+
}else if(b>a&&b>c){
15+
printf("%d is greatest\n",b);
16+
}else{
17+
printf("%d is greatest\n",c);
18+
}
19+
}
20+
21+
// Enter 3 numbers: 8
22+
// 85
23+
// 56
24+
// 85 is greatest

0 commit comments

Comments
 (0)