You are on page 1of 4

Kingdom of Saudi Arabia ‫اململكة العربية السعودية‬

Ministry of Education ‫وزارة التعليم‬


Al-Baha University ‫جامعة الباحة‬

Introduction to algorithms

Homework #1

Question 1: ( 5 Marks)

1. Write an algorithm, pseudocode and draw a flowchart for each of the


following program:

A. Find the product of two numbers (this means to multiply the two
numbers).

Algorithm
1-Ask the user or enter 2 numbers(A,S)
2-make sub =A*S
3-Display sub

Pseudo code Flowchart

Pseudo code:1-inputA,S
2-sub=A*S
3-print sub
B. Change the volume in pints to liters (there are 2.2 pints in every litter).

Algorithm

1-Ask Every 1 pint becomes a litre


2-Make each 1 liter equal to (2.2)
3-Display sub

Pseudo code Flowchart


2. List the 7 steps for program development?
1-De ne the problem into three separate components:
-lnputs.
-processing steps to produce required outputs.
-outputs.
2. Outline the solution.
Decompose the problem to smaller steps. Establish a solution outline.
3. Develop the outline into an algorithm.
The solution outline is now expanded into an algorithm.
4. Test the algorithm for correctness.
Very important in the development of a program, but often
forgotten.
Major logic errors can be detected and corrected at an early stage.
5. Code the algorithm into a speci c programming language.
6. Run the program on the computer.
This step uses a program compileror interpreter, and
programmer-designed test data to machine-test the code for
Syntax errors Runtime errors Logic errors
7. Document and maintain the program.

Submission policy:
• Deadline: Sunday 8/10/2023. 11:59 pm
‫ ص‬١٢ ‫ اكتوبر قبل الساعه‬٨ ‫اخر موعد للتسليم يوم االحد‬
fi
fi
• Each student should solve the homework by herself.
‫يجب على كل طالبة حل الواجب بنفسها‬
• Upload the homework on ra d
‫يتم رفع ملف االجابة عبر رافد‬
• only PDF le are accepted
.‫يجب ان تكون االجابة في ملف بي دي اف و لن تقبل اي صيغ اخرى مثل الصور‬
• in case you nd di culty in drawing the owchart using MS Word, you can draw it
using paper and pen and add the image of the solution to your document
‫ باإلمكان الرسم بإستخدام ورقة و قلم و من‬،‫في حال واجهتي صعوبه في رسم الفلوشارت باستخدام برنامج الوورد‬
‫ثم اضافة صوره الرسمه تحت السؤال‬
fi
fi
ffi
fi
fl

You might also like