IT Model Exercise (Questions Answers)
IT Model Exercise (Questions Answers)
Question 01 - DONE
Write a program that counts the even and odd numbers from 1 to a given positive integer.
The program should use iteration to perform the calculation.
Requirement
• Prompt a user to input the positive number
• Validate that the entered value is a positive number.
• Display the total count of even and odd numbers separately.
START
SET EVEN = 0, ODD = 0, N = 1
READ “Enter a positive number?”
STORE in variable VALUE
IF (VALUE > 10) THEN
REPEAT (N < VALUE)
IF (N mod 2 = 0) THEN
EVENT = EVENT + 1
ELSE
ODD = ODD + 1
END IF
N=N+1
END REPEAT
PRINT “Total Even Nos: + EVEN
PRINT “Total Odd Nos:”+ ODD
ELSE
PRINT “Invalid number!”
END IF
END
Question 02 - DONE
Write a program for a shop to calculate the total for three items and the balance to be given
for the customer.
Requirement
• Prompt the user to enter the quantity & price of the item purchased.
• Repeat the above step for the next two items using a loop.
• Prompt the user to enter the cash in.
• Display the total of the three items purchased, along with the balance.
START
SET TOTAL = 0, COUNTER = 1
REPEAT (COUNTER < 3)
READ “Enter the price?”
STORE in variable PRICE
READ “Enter the quantity?”
STORE in variable QTY
TOTAL = TOTAL + (PRICE * QTY)
COUNTER = COUNTER + 1
END REPEAT
READ “Enter the cash in value?”
STORE in variable CASHIN
BALANCE = CASHIN – TOTAL
PRINT “Total:” + TOTAL
PRINT “Balance:” + BALANCE
END
Question 03
Write a program that accepts three positive number inputs, and find the biggest and smallest
number from the series. (Maximum number value is 100)
Requirement
• Prompt the user to input three numbers
• Validate that all the user input as if it is a positive number.
• Display the biggest and smallest numbers separately.
A – 70 & Above
B – 50 & Above
C – 30 & Above
FAIL – Below 30
Requirement
• Prompt the user to enter the mark (input) for each subject individually.
• Display the calculated total, average and the grade.