Code: #define f(a,b,c,d) (a>b?(a>c?(a>d?a:d):(c>d?c:d)):(b>c?(b>d?b:d):(c>d?c:d))) #include<stdio.h> #include<conio.h> void main() { int a, b, c, d, k; clrscr(); printf("Enter the value of a, b, c, d\n"); scanf("%d%d%d%d", &a, &b, &c, &d); printf("\n%d\n", f(a, b, c, d)); getch(); }
hey guys ':' followed by '(' is acting as sad smiley so pls whereever u se smiley replace it by ':' follwed by '(' ... Thanks Nagesh
I have edited that for no smiley as well as proper formating. Here is the code snippet again for you Code: #define f(a,b,c,d) (a>b?(a>c?(a>d?a:d):(c>d?c:d)):(b>c?(b>d?b:d):(c>d?c:d))) #include<stdio.h> #include<conio.h> void main() { int a, b, c, d, k; clrscr(); printf("Enter the value of a, b, c, d\n"); scanf("%d%d%d%d", &a, &b, &c, &d); printf("\n%d\n", f(a, b, c, d)); getch(); }
Just try and you can do taking a sort of template not exactly template. Because i need this requirement...