[go: up one dir, main page]

0% found this document useful (0 votes)
23 views15 pages

PF-lab 1 and 2

The document contains pseudocode for several programming problems, including calculating averages and passing/failing status from test scores, computing factorials, determining paper needs for a meeting, comparing values in an if/else statement, and calculating board footage needed to build a bookcase. The pseudocode includes variable declarations, inputs, calculations, conditionals, outputs, and loops to iterate through each problem.

Uploaded by

danianoor03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views15 pages

PF-lab 1 and 2

The document contains pseudocode for several programming problems, including calculating averages and passing/failing status from test scores, computing factorials, determining paper needs for a meeting, comparing values in an if/else statement, and calculating board footage needed to build a bookcase. The pseudocode includes variable declarations, inputs, calculations, conditionals, outputs, and loops to iterate through each problem.

Uploaded by

danianoor03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

NED University of Engineering &

Start

Variable Declaration

Input Score

Total score = total score + score

Num _passed=
Is total Yes
num_passed+1
score>50

No

Num_failed=Num_failed+1

I=i+1

No
Is i =5?

Yes

Average_score=total_score
/5

No Yes
Print ’Passing’ Is Print ’Failing’
num_failed
>0

Print average_score,
num_failed, num_passed
Begin
Variables total_score=0 , num_failed = 0
For count = 1 To 5 do
Input score
total_score = total_score + score
IF score >=50 Then
num-passed=numpassed+1
ELSE
num-failed=num-failed+1
ENDIF
ENDFOR
average-score=total_score/5
IF num_failed>0 Then
Output ‘The student is failing the course’
ELSE
Output ‘The student is passing the course’
ENDIF
Output ‘average score:’ , average_score
Output ‘Number of failed course:’ , num_failed
Output ‘Number of passed course:’ , num_passed
END
Begin
Variable factorial = 1
INPUT number
For i < = number
factorial = factorial * i
i=i+1
ENDFOR
OUTPUT ‘factorial of ‘ , number , “is”, factorial
END
Begin
Variable PagesPerReport, people count, extra
copies = 5,
Sheet per ream = 500
Print ‘Enter number of people at the meeting’
INPUT PagesPerReport
Print ‘Enter number of people at the meeting’
INPUT PeopleCount
TotalPages = (PeopleCount + ExtraCopies) *
PagesPerReport
TotalReams = (totalPages/SheetsPerReam)
TotalPages MOD sheetPerReam! = 0 THEN
TotalReam = totalReam + 1
ENDIF
OUTPUT ‘Joe needs to order’, totalReams, “reams
of paper”
END
BEGIN
Variable a,b,c
IF a>b AND b>c THEN
Print b
ELSE
Print c
ENDIF
END
Q no. 2
Begin
Variables height, width, depth = 12, num of
shelves = 5
OUTPUT “Enter the height of bookcase in feet”
INPUT height
OUTPUT “Enter the width of bookcase in feet”
INPUT width
new height = height 12*
new width = width 12*
total board length = (height *2 + ‘width’)
*num shelves
new total board length = total board length / 12
OUTPUT “Joe needs”, new total board length,
“feet of 12 inch wide boards to complete the
bookcase”

You might also like