Conditional Statement Problems
Conditional Statement Problems
Problem Statement: Design a flowchart to simulate the process of withdrawing cash from an
ATM. Include steps such as card insertion, PIN validation, checking the account balance, and
dispensing cash.
Steps:
1. Insert card.
2. Enter PIN.
3. Verify PIN (if correct, continue; if incorrect, allow up to 3 retries, then exit).
4. Check if sufficient funds are available.
5. If yes, dispense cash and update balance.
6. Eject card and display a successful transaction message.
Problem Statement: Create a flowchart to check if a user’s login credentials are correct. The
system should grant access if both username and password match predefined values.
Steps:
1. Start.
2. Input username and password.
3. Compare with stored values (e.g., "admin" and "password123").
4. If both are correct, grant access and display "Login Successful."
5. If incorrect, allow up to 3 attempts.
6. If all attempts are used, lock the account and display "Access Denied."
Problem Statement: Draw a flowchart to assign a letter grade based on a student’s score in a
subject.
Steps:
1. Start.
2. Input student’s score (0–100).
3. Check the range:
Score 90–100: Grade A.
Score 80–89: Grade B.
Score 70–79: Grade C.
Score 60–69: Grade D.
Score below 60: Grade F.
4. Output the grade.
5. End.
Problem Statement: Design a flowchart that calculates the discount for a customer based on
their total purchase amount.
Steps:
1. Start.
2. Input the total purchase amount.
3. Check the amount:
If the amount is greater than $1000, apply a 10% discount.
If between $500–$1000, apply a 5% discount.
If below $500, no discount.
4. Calculate the final amount after applying the discount.
5. Display the discounted amount.
6. End.
Problem Statement: Create a flowchart to find the largest of three given numbers.
Steps:
1. Start.
2. Input three numbers (A, B, and C).
3. Compare A with B and C:
If A is greater than both, A is the largest.
4. If not, compare B with A and C:
Problem Statement: Design a flowchart for a simple calculator that performs addition,
subtraction, multiplication, or division based on user input.
Steps:
1. Start.
2. Input two numbers.
3. Ask the user to select an operation (+, -, *, /).
4. Perform the operation:
Addition if the user chooses +.
Subtraction if the user chooses -.
Multiplication if the user chooses *.
Division if the user chooses /.
5. Display the result.
6. End.
Problem Statement: Create a flowchart for a vending machine that dispenses items based on
user selection and checks if sufficient funds are provided.
Steps:
1. Start.
2. Display items with prices.
3. User selects an item.
4. Input the amount paid.
5. Check if the amount is sufficient:
If yes, dispense item and return any change.
If no, prompt to add more money.
6. End.
Problem Statement: Create a flowchart to calculate Body Mass Index (BMI) and categorize it
as Underweight, Normal, Overweight, or Obese.
Steps:
1. Start.
2. Input weight (in kg) and height (in meters).
3. Calculate BMI using the formula: BMI=weight/height*height
4. Categorize BMI:
BMI < 18.5: Underweight.
BMI 18.5–24.9: Normal.
BMI 25–29.9: Overweight.
BMI ≥ 30: Obese.
5. Display BMI and category.
6. End.