Tagged
• Flow Chart
•

Problem Statement

```1Problem Description : Find the largest of three numbers. 2
3Example 1 :  4Input  : a = 3,  b = 7 and c = 4 5Output : 7 6Explanation : 7 is the largest number. 7
8Example 2 : 9Input  : a = 12, b = 1 and c = 710Output : 12 11Explanation : 12 is the largest number. ```

Algorithm

`1Input : Three numbers a, b and c2Step 1: Start 3Step 2: Read number a 4Step 3: Read number b 5Step 4: Read number c6Step 5: if a > b Goto Step 6, else Goto Step 77Step 6: if a > c Print a, else Print c8Step 7: if b > c Print b, else Print c9Step 8: Stop 10Output : Largest number among a, b and c`

Code Implementation

1. Java
2. C

```1import java.util.Scanner;2
3public class LargestOfThreeNumbers {4
5  public static void main(String[] args) {6    int a, b, c;7    Scanner sc = new Scanner(System.in);8
9    System.out.print("Enter a: ");10    a = sc.nextInt();11    System.out.print("Enter b: ");12    b = sc.nextInt();13    System.out.print("Enter c: ");14    c = sc.nextInt();15
16    if (a > b) {17      if (a > c) {18        System.out.printf("Largest Number is : %d \n", a);19      } else {20        System.out.printf("Largest Number is : %d \n", c);21      }22    } else {23      if (b > c) {24        System.out.printf("Largest Number is : %d \n", b);25      } else {26        System.out.printf("Largest Number is : %d \n", c);27      }28    }29  }30}```

Output 1:

`1Enter a : 272Enter b : 33Enter c : 74Largest Number is : 27`

Output 2:

`1Enter a: 52Enter b: 173Enter c: 84Largest Number is : 17 `

• Flow Chart
•
...