---
title: "Algorithm and flowchart for largest"
subject: "Computer Programming"
chapter: 2
key: "semester_1/computer_programming:algorithm-flowchart-largest-n"
source: https://www.bctengineer.com/q/semester_1/computer_programming/algorithm-flowchart-largest-n
site: BCT Engineering
---

# Algorithm and flowchart for largest

Computer Programming · Chapter 2: Problem solving using Computer

- Asked in: 2073 Chaitra, 3+3 marks
- Video: [7. Greatest of three numbers - Algorithm & Flowchart -#greatestofthreenumbers,#algorithms](https://www.youtube.com/watch?v=iNREA76O7Uw) — Preethi J
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/algorithm-flowchart-largest-n
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-2

## Question

Develop an algorithm and draw a flowchart to find the largest of N numbers.

## Short answer

Read N, set largest to the first number, then for each remaining number read and update largest if the number is larger; finally print largest.

## Answer

#### Algorithm
1. Start
2. Read `N` (count of numbers)
3. Read the first number `X` and set `L = X`
4. Set `I = 2`
5. While `I <= N`, repeat steps 6 to 8
6. Read `X`
7. If `X > L`, set `L = X`
8. Set `I = I + 1`
9. Print `L` as the largest number
10. Stop

#### Flowchart
```text
        ( Start )
            |
       / Read N /
            |
       / Read X /
            |
        [ L = X ]
        [ I = 2 ]
            |
     +----->|
     |      v
     |   < I <= N ? >--No--> / Print L / --> ( Stop )
     |      | Yes
     |  / Read X /
     |      |
     |  < X > L ? >--No---+
     |      | Yes         |
     |  [ L = X ]         |
     |      |             |
     |      +<------------+
     |      |
     |  [ I = I + 1 ]
     +------+
```

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. L is initially set to
   A. 0
   B. N
   C. the last number
   D. the first number read
   Answer: D. Avoids problems with negatives. (Key point: Initial value)

2. L is updated when
   A. X > L
   B. X < L
   C. X = N
   D. I > N
   Answer: A. A larger value replaces L. (Key point: Update rule)

3. The loop continues while
   A. I > N
   B. I <= N
   C. X > L
   D. L = 0
   Answer: B. Until all N numbers are read. (Key point: Loop condition)

4. After reading each number, I is
   A. set to 0
   B. set to N
   C. increased by 1
   D. decreased by 1
   Answer: C. Counts numbers read. (Key point: Counter)

## Related in Computer Programming

- [Algorithm for numbers divisible by 9 not 6](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgo-flowchart-divisible-9-not-6) — Computer Programming, chapter 2
- [Largest of n numbers in FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-largest-n-numbers) — Computer Programming, chapter 11
- [Algorithm for largest and smallest](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Adefine-algorithm-largest-smallest) — Computer Programming, chapter 2
- [Algorithm and flowchart: quadratic roots](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgo-flowchart-quadratic) — Computer Programming, chapter 2
- [Algorithm and flowchart: distance between points](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgo-flowchart-distance) — Computer Programming, chapter 2
- [Algorithm and flowchart help; Armstrong flowchart](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aalgorithm-flowchart-armstrong) — Computer Programming, chapter 2

## Related in other subjects

- [Largest of four integers processor](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Aspp-largest-of-four) — Embedded System, chapter 2
- [8086 ALP: largest and smallest, display](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aalp-8086-largest-smallest-display) — Microprocessor, chapter 3
- [Non-restoring division with flowchart](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Anonrestoring-explain) — Computer Organization and Architecture, chapter 5, asked 3×
- [Floating point division algorithm](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Afp-division) — Computer Organization and Architecture, chapter 5, asked 4×
