0% found this document useful (0 votes)
11 views

Assignment - Sequential Logic (Zaeem)

Uploaded by

zaeemxshah
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)
11 views

Assignment - Sequential Logic (Zaeem)

Uploaded by

zaeemxshah
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/ 4

Computer Homework Assignment Psuedo Code

Q1)
DECLARE Salary, Dearness, Rent, Gross : Real //declare variables

Dearness ← 0
Rent ← 0
Gross ← 0 // initialisation

INPUT “Enter Salary: ”, Salary //prompt user for input

Dearness ← Salary * (40/100)


Rent ← Salary * (20/100)
Gross ← Salary + Dearness - Rent //calculations

OUTPUT “Gross Income: “, Gross // output

Q2)
DECLARE Distance, Meters, Feets, Inches, CentiM : Real
//declaration

Meters ← 0
Feets ← 0
Inches ← 0
CentiM ← 0 // Initialisation

INPUT “Distance: “, Distance, “ km” // prompt user

Meters ← Distance * 1000


Feets ← Distance * 3280.8399
Inches ← Distance * 39370.078
CentiM ← Distance * 100,000 // Calculations

OUTPUT ”Meters: “, Meters


OUTPUT “Feet: “, Feets
OUTPUT “Inches: “, Inches
OUTPUT “CentiMeters: “, CentiM // Outputting converted
Values
Q3)
DECLARE Marks, Total, Average : REAL // declaration variable

Marks ← 0
Total ← 0 // initlisation
FOR i ← 0 TO 4
INPUT “Marks: ”, Marks // input from user
Total ← Total + Marks // totalling marks
NEXT i

Average ← Total / 5 // Averaging Marks

OUTPUT “Average Marks: ”, Average // Outputting result

Q4)
DECLARE Temp, Centigrade : REAL // declare variables

Centigrade ← 0 // Initialization

OUTPUT “Temperature in Fahrenheit: ”


INPUT Temp // Input from user

Centigade ← (5/9) * (Temp - 32) // Conversion

OUTPUT “Temperature in Centigade: ”, Centigrade // Outputting


Result

Q4)
DECLARE Length, breadth, Area, Perimeter : REAL // declaration

Area ← 0
Perimeter ← 0 // initialization

OUTPUT “Enter Length: ”


INPUT Length
OUTPUT “Enter Breadth: ”
INPUT Breadth // take input from user

Area ← length * Breadth


Perimeter ← 2 * (Length + Breadth) // calculating area and
perimeter
OUTPUT “Area: ”, Area
OUTPUT “Perimeter: ”, Perimeter // Outputting Result

Q5)
DECLARE Radius, Area, Circumference : REAL // declaration
CONSTANT pi ← 3.142 // declaring constant

Area ← 0
Circumference ← 0 // initialization

OUTPUT “Enter Radius: ”


INPUT Radius // input from user

Area ← pi * (Radius ^ 2)
Circumference ← 2 * pi * Radius // Calculation

OUTPUT “Area: ”, Area


OUTPUT “Circumference: ”, Circumference // outputting result

Q6)
DECLARE FirstName, LastName : STRING // declaration

OUTPUT “First Name: ”


INPUT LastName
OUTPUT “Last Name: ”
INPUT LastName // input from user

OUTPUT “Name: ”, LastName, “ “, FirstName // outputting result

You might also like