Introduction to Computer Science. Chapter 6: Algorithms

Σχετικά έγγραφα
( ) ( ) ( ) ( ) ( )( ) z : = 4 = 1+ و C. z z a z b z c B ; A و و B ; A B', A' z B ' i 3

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

( ) / ( ) ( ) على. لتكن F دالة أصلية للدالة f على. I الدالة الا صلية للدالة f على I والتي تنعدم في I a حيث و G دالة أصلية للدالة حيث F ملاحظات ملاحظات

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

The Simply Typed Lambda Calculus

ΓΡΑΜΜΙΚΟΣ & ΔΙΚΤΥΑΚΟΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Homework 3 Solutions

Instruction Execution Times

Advanced Subsidiary Unit 1: Understanding and Written Response

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

(C) 2010 Pearson Education, Inc. All rights reserved.

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

( ) ( ) ( ) ( ) v n ( ) ( ) ( ) = 2. 1 فان p. + r بحيث r = 2 M بحيث. n n u M. m بحيث. n n u = u q. 1 un A- تذآير. حسابية خاصية r

ιαδικτυακές Εφαρµογές

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

( ) [ ] الدوران. M يحول r B و A ABC. 0 2 α فان C ABC ABC. r O α دورانا أو بالرمز. بالدوران r نكتب -* النقطة ' M إلى مثال لتكن أنشي 'A الجواب و 'B

CHAPTER 12: PERIMETER, AREA, CIRCUMFERENCE, AND 12.1 INTRODUCTION TO GEOMETRIC 12.2 PERIMETER: SQUARES, RECTANGLES,

Areas and Lengths in Polar Coordinates

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

[1] P Q. Fig. 3.1

2 Composition. Invertible Mappings

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

Abstract Storage Devices

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

EE512: Error Control Coding

Spherical Coordinates

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 5: Component Adaptation Environment (COPE)

14 ح ر وجع ومطابق لألصل اليدوى وي طبع على مسئولية اللجنة الفنية. a b x a x b c. a b c

- سلسلة -2. f ( x)= 2+ln x ثم اعط تأويل هندسيا لهاتين النتيجتين. ) 2 ثم استنتج تغيرات الدالة مع محور الفاصيل. ) 0,5

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι

Math 6 SL Probability Distributions Practice Test Mark Scheme

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

يط... األعداد المركبة هذه التمارين مقترحة من دورات البكالوريا من 8002 إلى التمرين 0: دورة جوان 8009 الموضوع األول التمرين 8: دورة جوان

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

Κάθε γνήσιο αντίγραφο φέρει υπογραφή του συγγραφέα. / Each genuine copy is signed by the author.

ΣΤΥΛΙΑΝΟΥ ΣΟΦΙΑ

Parametrized Surfaces

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 11/3/2006

Areas and Lengths in Polar Coordinates

Συστήματα Διαχείρισης Βάσεων Δεδομένων

ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ

Code Breaker. TEACHER s NOTES

derivation of the Laplacian from rectangular to spherical coordinates

Strain gauge and rosettes

Lecture 2. Soundness and completeness of propositional logic

Matrices and Determinants

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

14 Lesson 2: The Omega Verb - Present Tense

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

ΑΡΙΣΤΟΤΕΛΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ

مادة الرياضيات 3AC أهم فقرات الدرس (1 تعريف : نعتبر لدينا. x y إذن

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

the total number of electrons passing through the lamp.

Πτυχιακή Εργασία. Παραδοσιακά Προϊόντα Διατροφική Αξία και η Πιστοποίηση τους

TMA4115 Matematikk 3

Other Test Constructions: Likelihood Ratio & Bayes Tests

ΙΠΛΩΜΑΤΙΚΗ ΕΡΓΑΣΙΑ. ΘΕΜΑ: «ιερεύνηση της σχέσης µεταξύ φωνηµικής επίγνωσης και ορθογραφικής δεξιότητας σε παιδιά προσχολικής ηλικίας»

PARTIAL NOTES for 6.1 Trigonometric Identities

Statistical Inference I Locally most powerful tests

- سلسلة -3 ترين : 1 حل التمرين : 1 [ 0,+ [ f ( x)=ln( x+1+ x 2 +2 x) بما يلي : وليكن (C) منحناها في معلم متعامد ممنظم

LESSON 12 (ΜΑΘΗΜΑ ΔΩΔΕΚΑ) REF : 202/055/32-ADV. 4 February 2014

ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΕΙΡΑΙΑ ΤΜΗΜΑ ΝΑΥΤΙΛΙΑΚΩΝ ΣΠΟΥΔΩΝ ΠΡΟΓΡΑΜΜΑ ΜΕΤΑΠΤΥΧΙΑΚΩΝ ΣΠΟΥΔΩΝ ΣΤΗΝ ΝΑΥΤΙΛΙΑ

SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018

Integrals in cylindrical, spherical coordinates (Sect. 15.7)

Aquinas College. Edexcel Mathematical formulae and statistics tables DO NOT WRITE ON THIS BOOKLET

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

Homework 8 Model Solution Section

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

HY380 Αλγόριθμοι και πολυπλοκότητα Hard Problems

On a four-dimensional hyperbolic manifold with finite volume

ΑΠΟΔΟΤΙΚΗ ΑΠΟΤΙΜΗΣΗ ΕΡΩΤΗΣΕΩΝ OLAP Η ΜΕΤΑΠΤΥΧΙΑΚΗ ΕΡΓΑΣΙΑ ΕΞΕΙΔΙΚΕΥΣΗΣ. Υποβάλλεται στην

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

ΑΡΙΣΤΟΤΕΛΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ ΤΜΗΜΑ ΟΔΟΝΤΙΑΤΡΙΚΗΣ ΕΡΓΑΣΤΗΡΙΟ ΟΔΟΝΤΙΚΗΣ ΚΑΙ ΑΝΩΤΕΡΑΣ ΠΡΟΣΘΕΤΙΚΗΣ

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

ΤΕΧΝΙΚΕΣ ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΑΦΟΥΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΥ. Εισαγωγή στη Java

Section 8.3 Trigonometric Equations

Congruence Classes of Invertible Matrices of Order 3 over F 2

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

Συντακτικές λειτουργίες

Notes on the Open Economy

The challenges of non-stable predicates

Study of In-vehicle Sound Field Creation by Simultaneous Equation Method

ΔΟΜΕΣ ΔΕΔΟΜΕΝΩΝ & ΑΛΓΟΡΙΘΜΟΙ ΕΡΓΑΣΤΗΡΙΟ

Approximation of distance between locations on earth given by latitude and longitude

Modern Greek Extension

(1) Describe the process by which mercury atoms become excited in a fluorescent tube (3)

Τέτοιες λειτουργίες γίνονται διαμέσου του

LESSON 14 (ΜΑΘΗΜΑ ΔΕΚΑΤΕΣΣΕΡΑ) REF : 202/057/34-ADV. 18 February 2014

5.4 The Poisson Distribution.

Transcript:

Introduction to Computer Science مقدمة في علم الحاسب Chapter 6: Algorithms الوحدة 6: الخوارزميات إعداد: أ. محمد دالي ابراهم 2016-1437 جامعة الكامل \ 1 Outline قائمة املحتوى 1. Introduction 2. Algorithm Representation 3. Algorithm Discovery 4. Efficiency and Correctness مقدمة تمثيل الخوارزميات اكتشاف الخوارزميات الفعالية والصواب.1.2.3.4 2 1

.1 مقدمة Introduction 1. 1. Definition 2. Examples 3. Quick practice tests 4. Brief History تعريف أمثلة تمارين تطبيقية سريعة نبذة تاريخية.1.2.3.4 3 1. Definition: An Algorithm is an ordered set of unambiguous, executable steps that defines a terminating process..1 مقدمة Introduction 1. 2. Examples: Prepare a scrambled egg dish for one person The recipe (Algorithm): Prepare a pan, oil, salt, three eggs, a plate Put a small quantity of oil and salt in the pan Put the pan on the stove and light it at the lowest level Crack the eggs into the pan and stir all together Wait until it becomes solid and begin to turn to brown Empty the pan into the plate Put the plat on the table with some drink The end 1. تعريف: الخوارزمية هي مجموعة خطوات مرتبة وواضحة وقابلة للتنفيذ لعمل محدد له نهاية. 2. أمثلة: تحضير أكلة بيض مقلي لشخص واحد الطريقة )الخوارزمية(: إحضار اللوازم: مقالة زيت ملح 3 حبات بيض صحن وضع كمية مناسبة من الزيت وامللح في املقالة وضع املقالة على الفرن ثم أوقده ونزل الشعلة الى أقل مستوى أكسر البيض في املقالة وخلط الكل مع بعض انتظر حتي يتصلب البيض ويبدأ يتحول الي البني ثم أطفئ الفرن أفرغ املقالة في الصحن ضع الصحن على السفرة مع الخبز واملشروب املناسب نهاية 4 2

2. Examples (continued): Compute the surface of a sphere with radius equal to 5 cm The Algorithm: The rule for the surface is: 4πR 2 Compute: 4 * 3.14 = 12.56 Compute: 12.56 * 5 * 5 = 314 The surface of the sphere is: 314 cm 2 The end.1 مقدمة Introduction 1. أمثلة )تابع(: أحسب مساحة سطح كرة نصف قطرها 5 سم.2 الخوارزمية: القاعدة الحسابية ملساحة كرة: π 4 نق 2 أحسب: * 4 3.14 = 12.56 أحسب: * 12.56 5 * 5 = 314 مساحة الكرة : 314 سم 2 نهاية 5.1 مقدمة Introduction 1..3 تمارين تطبيقية سريعة tests: 3. Quick practice a. Write the algorithm to find the greatest number among five number: n1, n2, n3, n4 and n5 The Algorithm: The rule for the volume is: 4/3πR 3 Compute: 4/3 = 1.33 Compute: 1.33 * 3.14 = 4.18 Compute: 4.18 * 5 * 5 * 5 = 523.33 The volume of the sphere is: 523.33 cm 3 The end أ. أكتب الخوارزمية التي تحسب حجم كرة نصف قطرها 5 سم الخوارزمية: 3 القاعدة الحسابية لحجم كرة: 4\3 * π قن* أحسب: 3\4 = 1.33 أحسب: * 1.33 3.14 = 4.18 أحسب: * 4.18 5 * 5 * 5 = 523.33 حجم الكرة : 523.33 سم 3 نهاية 6 3

ك 4/13/2016 1. Introduction.1 3. Quick practice tests:.3 b. Write the algorithm to find the greatest number ب. أكتب الخوارزمية التي تستخرج العدد ألاكبر من among five number: n1, n2, n3, n4 and n5 ضمن 5 أعداد: ع 1 ع 2 ع 3 ع 4 و ع 5 The Algorithm: Compare between the two first numbers in the list مقدمة تمارين تطبيقية سريعة الخوارزمية: قارن بين العددين ألاولين في القائمة ع 1 وع 2 وجعل أكبرهم هو الناتج ك قارن بين الناتج السابق والعدد املوالي في القائمة ع 3 أجعل أكبرهما هو الناتج ك قارن بين الناتج السابق والعدد املوالي في القائمة ع 4 أجعل أكبرهما هو الناتج ك قارن بين الناتج السابق والعدد ألاخير في القائمة ع 5 أجعل أكبرهما هو الناتج النهائي ك هو العدد ألاكببر نهاية 7 4. Brief History:.1 مقدمة Introduction 1. The words 'algorithm' and 'algorism' come from the name al-khwārizmī. Al-Khwārizmī (.,c خوارزمي 780-850) was a muslim mathematician, astronomer, geographer, and scholar in the House of Wisdom in Baghdad, whose name means 'the native of Khwarezm', a region that is part of Uzbekistan. About 825, he wrote a treatise in the Arabic language, which was translated into Latin in the 12th century under the title Algoritmi de numero Indorum. This title means "Algoritmi on the numbers of the Indians", where "Algoritmi" was the translator's Latinization of Al-Khwarizmi's name. Al-Khwarizmi was the most widely read mathematician in Europe in the late Middle Ages, primarily through his other book, the Algebra. In late medieval Latin, algorismus, English 'algorism', the corruption of his name, simply meant the "decimal number system". In the 15th century, under the influence of the Greek word ἀριθμός'number' (cf. 'arithmetic'), the Latin word was altered to algorithmus, and the corresponding English term 'algorithm' is first attested in the 17th century; the modern sense was introduced in the 19th century. 4. نبذة تاريخية: أبو عبد هللا محمد بن موس ى الخوارزمي عالم مسلم يكنى باسم الخوارزمي و أبو جعفر قيل أنه ولد في حوالي 164 ه 781 م في منطقة خوارزمى التي تقع حاليا في جمهورية أزباكستان وقيل أنه توفي في 232 ه 847 م يعتبر من أوائل علماء الرياضيات املسلمين حيث ساهمت أعماله بدور كبير في تقدم الرياضيات في عصره. اتصل بالخليفة العباس ي املأمون وعمل في بيت الحكمة في بغداد وكسب ثقة الخليفة إذ واله املأمون بيت الحكمة كما عهد إليه برسم خريطة لألرض عمل فيها أكثر من 70 جغرافيا وقبل وفاته كان الخوارزمي قد ترك العديد من املؤلفات في علوم الفلك والجغرافيا من أهمها كتاب الجبر واملقابلة الذي يعد أهم كتبه وقد ترجم الكتاب إلى اللغة الالتينية في سنة 1135 م وقد دخلت على إثر ذلك كلمات مثل الجبر Algebra والصفر Zero إلى اللغات الالتينية. 8 4

1. Plain text 2. Pseudo-code 3. Flowchart 4. Program Code نص عادي الشفرة... مخطط الانسياب شفرة البرامج.1.2.3.4 9 2. Algorithm Representation.2 Algorithm representation is the way in which it is presented to the processing entity which could be a human being or a device such as a computer 1. Human language: The first such representation is natural languages such as English The previous example about the algorithm How to prepare a scrambled egg dish for one person was presented using Normal English Prepare a pan, oil, salt, three eggs, a plate Put a small quantity of oil and salt in the pan Put the pan on the stove and light it at the lowest level This type is used when the algorithm is presented to a human being for execution such as a cook in a restaurant تمثيل الخوارزمية يعني الشكل الذي تعرض من خالله الى الكيان الذي ينفذها والذي يمكن أن يكون إنسانا ويمكن أن يكون آلة مثل الحاسوب اللغة العادية تمثيل الخوارزميات أول شكل لتمثيل الخوارزمية هو اللغات البشرية العادية مثل العربية. املثال السابق عن خورزمية تحضير أكلة بيض مقلي لشخص واحد تم عرضها بطريقة النص العادي في اللغة العربية: إحضار اللوازم: مقالة زيت ملح 3 حبات بيض صحن وضع كمية مناسبة من الزيت وامللح في املقالة... يستخدم هذا النوع من تمثيل الخوازميات عند عرضها على إلانسان للتنفيذ مثل عامل في مطعم 10.1 5

2. Pseudo code: It is a like a normal language such as English which doesn't follow closely the language rules and uses a limited set of statements oriented to computer processing rather than human processing Example: Compute the volume of a sphere with radius equal to R cm The Algorithm in pseudo code: Start Res = 4 / 3 Res = Res * π (3.14) Res = Res * R 3 Sphere volume = Res in cm 3 The end الشفرة املختصرة يشبه اللغة العادية مثل الانجليزية ولكن ال تتبع قواعدها بشكل صارم ويستخدم مجموعة محددة من العبارات املوجهة الى جهاز الحاسوب للتنفيذ مثال: أحسب حجم كرة نصف قطرها قن الخوارزمية بالشكل الشفرة املختصرة بداية ن = 4 \ 3 )3.14( π * ن = ن ن = ن * نق 3 حجم الكرة = ن نهاية.2 11 2. Pseudo code: Remarks: In the computing field pseudo code is used to represent algorithms before the programming phase It is mostly in English It is independent of the programming language to be used. الشفرة املختصرة مالحظات: تستخدم الشفر املختصرة في مجال الحاسب لتمثيل الخوازميات قبل تحولها الى برامج حاسب في إحدى لغات البرمجة مثل جافا س ي. ++ C++,Java( ), اللغة الانجليزية هي السائدة في هذا املجال الشفرة املختصرة مستقلة عن لغات البرمجة.2 12 6

3. Flowchart: It is a Example: Compute the volume of a sphere with radius equal to R cm هو تمثيل نص ي رسومي للخوارزمية بنظرة أن التنفيذ سيتم عن طريق الحاسب. مثال: أحسب حجم كرة نصف قطرها قن ح بداية 3 \ 4 = 3. خرائط الانسياب ح = ح * 3.14 ح = ح * نق 3 الحجم = ح نهاية 13 3. Flowchart: It is 3. خرائط الانسياب توجد أربعة )4( أنواع رئيسية من الرسومات الانسيابية: مخططات العمليات التتابعية (Sequential Flowcharts). مخططات العمليات ذات التفرعات (Branched Flowcharts). 14 7

ن 4/13/2016 3. Flowchart: It is a 3. خرائط الانسياب )تابع( مخططات العمليات ذات الاختيارات (Selection Flowcharts). إذا... نعم ال مخططات العمليات ذات التكرار الدائري (Loop Flowcharts).. ال نهاية التكرار نعم 15 تمثيل الخوارزميات 3. خرائط الانسياب مثال: القاعدة: ن! = ن 2. Algorithm Representation.2 )تابع( حساب مضروب أو عاملي لعدد ن :! 3. Flowchart: * )ن- 1 ( * )ى- 2 ( *... * 2 * 1 تطبيق للقاعدة على مثال:!4 = 4 * 3 * 2 * 1 = 24 مخطط الانسياب: إدخال قيمة ن ن! = 1 ن! = ن! * ن ن = ن- 1 البداية ال هل ن = 1 نعم الناتج هو ن! النهاية 16 8

تمثيل الخوارزميات 3. خرائط الانسياب تمارين: 2. Algorithm Representation.2 )تابع( إنشاء مخطط انسيابي لحساب ناتج ضرب الاعداد الفردية من 1 الى عدد "ن 3. Flowchart: 17 4. Program code: 4. شفرة البرامج: البرنامج هو مجموعة أوامر للحاسب لتنفيذ عمل معين تكتب ألاوامر في لغة من لغات برمجة الحاسب مثل جافا ) Java ( س ي. ++ )++C( شإ. تي. إم. أل...(HTML) 18 9

4. Program code: class sum_even_numbers import javax.swing.joptionpane; public class sum_even الى عدد يدخل public static void main( String args[] ). N int Total, Counter,N; String Value_From_KB; total = 0; Counter = 0; Value_From_KB= JOptionPane.showInputDialog("Enter a positive limit value: " ); N = Integer.parseInt(Value_From_KB); while (Counter <= N ) Total = Total + Counter; Counter = Counter + 2; JOptionPane.showMessageDialog( null, "The Sum off the positives EVEN Numbers less then " +N + "are : " + Total, JOptionPane.INFORMATION_MESSAGE ); System.exit( 0 ); 4. شفرة البرامج: مثال 1 كتابة برنامج في لغة جافا ) Java ( لحساب مجموع ألاعداد الزوجية من 2 عن طريق لوحة املفاتيح ونشير اليه بالحرف 19 Representation 2. Algorithm.2 تمثيل الخوارزميات 4. Program code: 4. شفرة البرامج: class _9_Mul_table public static void main ( string [ ] args ) System.out.println ( " multiplication table " ) ; System.out.println ( " ---------------------------------------------- " ); System.out.print ( " " ) for ( int j=1 ; j <= 9; j ++ ) System.out.print ( " " + j ); System.out.println ( " " ) ; for ( int i = 1 ; i <= 9 ; i ++ ) System.out.print ( i + " " ) ; for ( int j = 1 ; j <= 9 ; j ++ ) if ( i * j < 10 ) System.out.print ( " " + i* j ) ; else System.out.print ( " " + i * j ) ; System.out.println ( " " ) ; مثال 1 كتابة برنامج في لغة الضرب الى العدد 9 جافا ) Java ( لعرض جدول مقدمة في علم الحاسب - Science Introduction to Computer. 6 الخوارزميات - Algorithms 6. 20 10

.3 اكتشاف الخوارزميات Discovery 3. Algorithm 4. Program code: 4. شفرة البرامج: البرنامج هو مجموعة أوامر للحاسب لتنفيذ عمل معين تكتب ألاوامر في لغة من لغات برمجة الحاسب مثل جافا ) Java ( س ي. ++ )++C( شإ. تي. إم. أل...(HTML) 21 Introduction to Computer Science مقدمة في علم الحاسب Chapter 6: Algorithms الوحدة 6: الخوارزميات End of Chapter نهاية الوحدة 24 11