Sunday, 25 February 2018

Find the maximum Number Among Three Numbers in programming c


Program


  #include <stdio.h>

  int main()
  {
    int num1, num2, num3;
    printf("Enter three numbers: ");
    scanf("%d %d %d", &num1, &num2, &num3);

    if(num1>=num2 && num1>=num3)
    {
        printf("%d is the maximum number", num1);
    }
    else if(num2>=num1 && num2>=num3)
    {
        printf("%d is the maximum number", num2);
    }
    else
    {
        printf("%d is the maximum number", num3);
    }
    return 0;
 }





output

  Enter three numbers: 10  50  30
  50 is the maximum number

No comments:

Post a Comment