26: W.A.P. to find largest number among three numbers.

 

26: W.A.P. to find largest number among three numbers.

Program:

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

    int a, b, c;

 

    printf("Enter a, b, c as number = ");

    scanf("%d %d %d", &a, &b, &c);

 

    if (a > b)

    {

        if (a > c)

        {

            printf("\nThe Largest Number = %d", a);

        }

        else

        {

            printf("\nThe Largest Number = %d", c);

        }

    }

    else

    {

        if (b > c)

        {

            printf("\nThe Largest Number = %d", b);

        }

        else

        {

            printf("\nThe Largest Number = %d", c);

        }

    }

 

    getch();

}

 

 

Please follow me for more practicals....


Output:

Enter a, b, c as number = 3 4 5

 

The Largest Number = 5


Please follow me for more practicals....

 

Algorithm:

1.      START

2.      Declare a, b, c

3.      Enter the value of a, b, and c.

4.      If (a > b) then goto step 5 else goto step 8.

5.      If (a > c) then goto step 6 else goto step 7.

6.      Display a is largest.

7.      Display c is largest.

8.      if (b > c) then goto step 9 else goto step 10.

9.      Display b is largest.

10.  Display c is largest.

11.  STOP

 

Please follow me for more practicals....


Flowchart:


Please follow me for more practicals....



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.