You are on page 1of 12

INTRODUCTION TO COMPUTING

(EE-116)

Pseudo-Code, Algorithm, Flowcharts


Assignment # 1
Name: Ahmad Raza
Roll No :f178398 Section: B

NATIONAL UNIVERSITY OF COMPUTER AND EMERGING SCIENCES,CHINIOT-


FAISALABAD CAMPUS
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

Q.1
PSEUDO CODE
1. Integer Input a,b
2. Sum=a+b
3. Display sum
4. Subtract=a-b
5. Display Subtract
6. Multiply=a*b
7. Display multiply
8. Division=a/b
9. Display division
10.Remainder=a%b
11.Display reminder
12.Stop
Start

Input=a,b

Display Display Display


Sum=a+b Subtract=a-b Multiply=a*b
sum subtract multiply

Display Remainder=a Display


Divide=a/b
divide %b remainder

Stop

Q.2
PSEUDO CODE
1. Int Input a,b
2. Input operator=o “+,-,*,/,%”
3. Calculation=a o b

Page 2 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

4. Display calculation
5. If user want to repeat process then go to 1st statement else stop
Start

Input a,b

Input
operator=o

Calculation=aob Yes

Display
calculation

If user want to
continue

No
Stop

Q.3
PSEUDO CODE
1. Input base,exponent
2. Power= base ^ exponent
3. Display power

Page 3 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

4. If user press S key then stop else return to 1st statement

Start

Input
base,exponent

No
Power=base^exponent

Display
power

If s key is
pressed

Yes

stop

Q.4
PSEUDO CODE
1. Input vowel={a,e,i,o,u}
2. Input b1
3. Check if b1==vowel then display vowel else display not vowel
4. Display result

Page 4 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

5. Stop

Start

Input
vowel={a,e,I,o,u}

Input=a1

Display
If Display
not No Yes
a1==vowel vowel
vowel

Stop

Q.5
PSEUDO CODE
1. Input x,sum=0
2. Input a=1
3. Input number=y
4. Sum=y+sum
5. a=a+1
6. If x<a then next step else goto 3rd statement
7. Average=sum/x
8. Display average
9. Stop

Page 5 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

Start

Input total
numbers=x,
sum=0

Input a=1

Input
number=y

No
sum=y+sum

a=a+1

If x<a

Yes

Average=sum/x

Display
average

Stop

Page 6 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

Q.6
PSEUDO CODE
1. Input x,total=x
2. Input x
3. total=x+total
4. Display total
5. If user press -1then stop else goto 2nd statement

Page 7 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

Start

Input x
,total=x

Input x

Total=x+total No

Display total

If -1 is
pressed

Yes

Stop

Q.7
PSEUDO CODE
1. Input username=ahmadraza
2. Input password=123456789
3. Input x “username”
4. Check if username==x then ask password else display incorrect

Page 8 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

and stop
5. Input y “password”
6. Check if password==y then display welcome else display incorrect and stop
Start

Input username=Ahmad
Input password=123456

Input username x

Display
If x==username No
incorrect

Yes

Input password y

Display
If y==password No
incorrect

Yes

Display
welcome

Stop

Q.8
PSEUDO CODE
1. Input vi,t,a
2. Calculate distance by s=vi*t+1/2*a*t^2

Page 9 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

3. Display distance
4. Stop

Start

Input Vi,t,a

S=Vi*t+½*a*t^2

Display
distance=S

Stop

Q.9
PSEUDO CODE
1. Input time=x
2. If time 9<=x<=11 then display good morning
3. If time 12<=x<=15 then display good afternoon
4. If time 16<=x<=19 then display good evening
5. If time 20<=x<=23 then display good night
6. Stop

Page 10 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

Start

Input
time=x

display
If 9<=x<=11 Yes good
morning

No

display
If 12<=x<=15 Yes good
afternoon

No

display
If 16<=x<=19 Yes good
evening

No

display
If 20<=x<=23 Yes good
night

Start

Page 11 of 12
t#Assignmen
ITC National University Roll
of Computer and Emerging Sciences No:8398
(EE 116) Chiniot- Faisalabad campus Spring 2017 01

Q.10
PSEUDO CODE
1. Input current year=2017
2. Input birth year=x
3. Age=current year-birth year
4. Display age
5. Stop

Start

Input current
year=2017

Input birth
year=x

Age=current year-
birth year

Display age

Stop

Page 12 of 12

You might also like