Skip to content

Commit 91cb93a

Browse files
committed
ternary operator added
1 parent db0d596 commit 91cb93a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

questions/question6.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ int main(){
1212
printf("enter 3 integers:\n");
1313
scanf("%d %d %d", &a,&b,&c);
1414

15-
max = (a > b && a > c)? a: (b > c)? b: c;
16-
min = (a < b && a < c)? a: (b < c)? b: c;
15+
max = (a>b)?((a>c)?a:c):((b>c)?b:c); //oneway
16+
min = (a < b && a < c)? a: (b < c)? b: c; //another way
1717

1818
printf("max number is: %d\n", max);
1919
printf("min number is: %d\n", min);

0 commit comments

Comments
 (0)