Saturday, August 20, 2011

Program to find the greatest number among three numbers without using nested if else.

//Program to find the greatest number among three numbers without using nested if else.
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c,d;
 clrscr();
 printf("The values of a,b and c");
 scanf("%d%d%d",&a,&b,&c);
 if(a>b)
 {
  d=a;
 }
  else
  {
   d=b;
  }
  if(c>d)
  {
   d=c;
  }
  else
  {
   d=d;
  }
 printf("\n Greatest no. is:%d",d);
 getch();
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More