Write a c program to find largest among three numbers

Using Conditional Operators:
int main()
{
  int a,b,c,Max;
  printf("\nEnter 3 numbers:");
  scanf("%d %d %d",&a,&b,&c);

  Max=(a>b&&a>c?a:b>c?b:c);
  printf("\nThe biggest number is: %d",Max);

  return 0;
}

No comments:

Post a Comment