Basic Input
Basic Input
BEGIN
INPUT number1
INPUT number2
PRINT sum
END
2. Write a pseudocode that takes a number and prints whether it is even or odd.
BEGIN
INPUT number
PRINT "Even"
ELSE
PRINT "Odd"
END IF
END
BEGIN
INPUT length
INPUT width
PRINT area
END
4. Write a pseudocode that asks for a number and prints its square.
BEGIN
INPUT number
PRINT square
END
BEGIN
INPUT celsius
PRINT fahrenheit
END
BEGIN
FOR i = 1 TO 10
PRINT i
END FOR
END
7. Write a pseudocode that calculates the sum of numbers from 1 to N, where N is user input.
BEGIN
INPUT N
sum = 0
FOR i = 1 TO N
sum = sum + i
END FOR
PRINT sum
END
8. Write a pseudocode that prints the multiplication table of a number entered by the user.
BEGIN
INPUT number
FOR i = 1 TO 10
result = number * i
PRINT result
END FOR
END
BEGIN
FOR i = 10 DOWNTO 1
PRINT i
END FOR
END
10. Write a pseudocode that asks for 5 numbers and calculates their average.
BEGIN
sum = 0
FOR i = 1 TO 5
INPUT number
END FOR
average = sum / 5
PRINT average
END
BEGIN
INPUT number
IF number > 0 THEN
PRINT "Positive"
PRINT "Negative"
ELSE
PRINT "Zero"
END IF
END
BEGIN
INPUT num1
INPUT num2
INPUT num3
PRINT num1
PRINT num2
ELSE
PRINT num3
END IF
END
BEGIN
INPUT age
ELSE
END IF
END
14. Write a pseudocode to display the grade based on a student's score. (e.g., A for 90+, B for 80–
89...)
BEGIN
INPUT score
ELSE
END IF
END
15. Write a pseudocode that checks whether a given year is a leap year.
BEGIN
INPUT year
IF (year MOD 4 = 0 AND year MOD 100 != 0) OR (year MOD 400 = 0) THEN
ELSE
END IF
END
Problem-Solving / Real-Life Scenarios
16. Write a pseudocode for a simple ATM withdrawal that checks balance before withdrawing.
BEGIN
INPUT balance
INPUT withdrawal_amount
ELSE
END IF
END
17. Write a pseudocode that simulates a login system with a preset username and password.
BEGIN
INPUT username
INPUT password
ELSE
END IF
END
18. Write a pseudocode for a shopping cart that calculates total price with tax.
BEGIN
INPUT item_price
INPUT tax_rate
19. Write a pseudocode to simulate a basic calculator (Add, Subtract, Multiply, Divide).
BEGIN
INPUT num1
INPUT num2
INPUT operation
IF operation = 1 THEN
END IF
END
20. Write a pseudocode that simulates a traffic light system (Red, Yellow, Green cycle).
BEGIN
WHILE TRUE
WAIT 30 SECONDS
WAIT 5 SECONDS
WAIT 30 SECONDS
END WHILE
END