Biggest of four Nos using Macro..

Nageshha's Avatar author of Biggest of four Nos using Macro..
This is an article on Biggest of four Nos using Macro.. in C.
Code: C
#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();
}
Nageshha's Avatar
Light Poster
hey guys ':' followed by '(' is acting as sad smiley so pls whereever u se smiley replace it by ':' follwed by '(' ...

Thanks
Nagesh

Last edited by Nageshha; 19Oct2005 at 11:50.. Reason: correction
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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();
}
Nageshha's Avatar
Light Poster
thanks shabbir..
imrantechi's Avatar, Join Date: Feb 2008
Ambitious contributor
good one
sydneytech's Avatar
Go4Expert Member
Can you make it generic for any number ( not only for four).
sydneytech's Avatar
Go4Expert Member
Just try and you can do taking a sort of template not exactly template.

Because i need this requirement...
heena.mca's Avatar, Join Date: Feb 2008
Go4Expert Member
Very good info for me.
lead.smart34's Avatar, Join Date: Feb 2008
Contributor
good one
crazytolearn57's Avatar, Join Date: Feb 2008
Go4Expert Member
good one