Jump to content

Find the greatest number from 3 integers using C

From IdeaWazaWiki
Revision as of 23:25, 8 June 2009 by wikademia>Wikademia (moved To find the Greatest number from 3 integers using C to Find the greatest number from 3 integers using C)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<source lang="c">

  1. include<stdio.h>

/* main: display largest of three unequal values */ int main(void) {

   int a, b, c;
   printf("enter three unequal integers: ");
   scanf("%d%d%d", &a, &b, &c);
   printf("%d", (a > b ? a : b) > c ? (a > b ? a : b) : c);
   /* indicate success */
   return 0;

} </source>