Page 10 - Short and Long Questions CH-1
P. 10
PAKISTAN INTERNATIONAL SCHOOL, JUBAIL
MAXIMIZE LITERACEY FOR THE PROGRESS OF PAKISTAN
Sir Imran Ahmad N. Ahmad
Q.15) Problem: Convert Temperature from Fahrenheit to Celsius:
Answer:
Planning the Solution:
Input. Temperature in Fahrenheit
Required Output Temperature 1n Celsius.
Processing. Compute the temperature in Celsius from Fahrenheit using conversion
formula.
Algorithm:
Step 1: Start
Let the temperature in Fahrenheit F be 100
Step 2: CALCULATE temperature in Celsius (C).
Pakistan International School, Jubail
C = 5/9 (F - 32)
Step 3: Output C
Step 4: Stop.
Q.16) Problem 13: Find factorial of a given number.
Answer:
Planning the Solution:
Input: Given Number
Required Output: Factorial of given number
Processing: Find the product of all the numbers from 1 to the given number.
Algorithm:
Step 1: Start
Let the number, N be 5
Step 2: Initialize loop variable K and factorial F to 1
K=1, F=1
Step 3: CALCULATE the product
F=F*K
Step 4: Increment K by 1
K=K+1
Step 5: Check the value of K
IF K≤N THEN GOTO Step 3 otherwise GOTO Step 6
Step 6: Output F
Step 7: Stop
Page8
Pakistan international School Jubail 2022-2023 Class X