Code Logo

Check Bus Seat Available

Published at19 Apr 2026
Logic & Conditionals Easy 6 views
Like0

This problem comes from a simple travel situation. You know how many seats a bus has in total, and you know how many of those seats are already taken.

Your task is to decide whether there is still at least one seat available. If there is, print AVAILABLE. If every seat is already taken, print FULL.

For example, if the bus has 40 seats and 36 are already taken, the answer is AVAILABLE. But if the bus has 40 seats and all 40 are taken, the answer is FULL.

So the task is to compare the taken seats with the total seats and return the correct message.

Learn about our pseudocode specification
Guide

Example Input & Output

Example 1
Input
total = 40, taken = 36
Output
AVAILABLE
Explanation

There are still seats left, so the bus is not full yet.

Example 2
Input
total = 40, taken = 40
Output
FULL
Explanation

Every seat is already taken.

Example 3
Input
total = 12, taken = 0
Output
AVAILABLE
Explanation

If nobody has taken a seat yet, seats are still available.

Algorithm Flow

Recommendation Algorithm Flow for Check Bus Seat Available
Recommendation Algorithm Flow for Check Bus Seat Available

Solution Approach

A simple way to solve this is to compare two numbers.

First, read the total seat count and the number of taken seats. After that, check whether the taken seat count is smaller than the total seat count.

The condition is:

taken < total

If that condition is true, there is still room left, so you print AVAILABLE.

If that condition is false, the bus has no free seat left, so you print FULL.

This problem is really just one quick availability check.

Best Answers

Pseudocode - Approach 1
program check_bus_seat_available
dictionary
   total, taken: integer
algorithm
   input(total, taken)
   if taken < total then
      output("AVAILABLE")
   else
      output("FULL")
   endif
endprogram