Lecture15
Lecture15
CSE-1010 :Programming I
false
Input a number Display ‘Odd’
Remainder=Number if
mod 2 Remainder
=0
true
Display
‘Even’
myAnswer=myNumber *2
Display
myAnswer
Stop
6/8/2022 MIIT, Mandalay, CSE-1010 Programming I 13
Another example
• Step 1: Get the weight of object in kilograms as input data.
• We will call this as weight_in_kilos.
• Step 2: Calculate weight_in_pounds using the formula, weight_in_pounds
= weight_in_kilos * 2.20 This used the fact that 1 kilo is equal to 2.20
pounds.
Step1:start
Step2:input weight_in_killos
Step3:set weight_in_pounds=weight_in_killos*2.20
Step4:output weight_in_pounds
Step5:stop
Input n
i<=n-
i=2,f=0 i=i+1
1
no
If
n%i N%i=
=0
yes
no
F=1 Display
‘prime’
yes
Display
‘not Stop
6/8/2022 prime’
MIIT, Mandalay, CSE-1010 Programming I 18
References
Online content
Prof. KRV “Raja” Subramanian, Prof Usha Subramanian, "Introduction
to Computing",Courseware for CSE 1010 Programming
—Bill Gates, Co-Chairman, Bill & Melinda Gates Foundation, Co-Founder, Microsoft