Search This Blog

Saturday, 23 September 2017

C Program to find max. Among 3 nos.

/* Finding max among three numbers */

#include<stdio.h>
#include<conio.h>

void main()
{
 int no1,no2,no3;
 clrscr();
 printf("Enter three Numbers : ");
 scanf("%d%d%d",&no1,&no2,&no3);

 if(no1==no2&&no2==no3)
 {
  printf("\nAll Numbers are SAME");
 }
 else
 {
  if(no1>no2&&no1>no3)
   printf("\n%d is max",no1);
  if(no2>no1&&no2>no3)
   printf("\n%d is max",no2);
  else
   printf("\n%d is max",no3);
 }

 getch();
}




No comments:

Post a Comment