دستورات کنترل و تکرار- 2 اصول كامپيوتر 1.

Slides:



Advertisements
Similar presentations
در جامعه، افرادي که موقعيت و مسؤليت خود را مي‌دانند از راحتي و امنيت بيشتري برخوردارند هر کلاس از جامعه، مجموعه‌اي از امکانات و تواناييهاي مجاز برخوردار.
Advertisements

 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.11 Assignment Operators 2.12 Increment and Decrement Operators.
1 آزمايشگاه سيستم های هوشمند ( Domain-specific Architecture.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
LOOPING do { } while ( ) for (I = 0; I < 5; I++) { } while ( ) { }
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
ارائه روشي براي شناسايي کاراکترهاي دستنويس، برپايه شبکه LVQ.
Control Statements (II) Ying Wu Electrical & Computer Engineering Northwestern University ECE230 Lectures Series.
ارائه درس روباتيکز Extended Kalman Filter فريد ملازم استاد مربوطه دکتر شيري دانشگاه امير کبير – دانشکده کامپيوتر و فناوري اطلاعات.
نام و نام خانوادگي : فريد ملازم 1 آزمايشکاه سيستم هاي هوشمند ( موضوع ارائه Process and Deployment Design.
 2003 Prentice Hall, Inc. All rights reserved. 1 Algorithms Computing problems –Solved by executing a series of actions in a specific order Algorithm.
Control Structures in C++ while, do/while, for switch, break, continue.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 4 - Program Control Outline 4.1Introduction 4.2The Essentials of Repetition 4.3Counter-Controlled.
1 Review C++_ the unit of programming is the class from which objects are eventually instantiated. C++ classes contain functions that implement class class.
مراحل مختلف اجرای يک برنامه
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1Introduction 2.2Algorithms 2.3Pseudocode 2.4Control Structures.
1 Lecture 4 for loops and switch statements Essentials of Counter-Controlled Repetition Counter-controlled repetition requires  Name of control.
 2003 Prentice Hall, Inc. All rights reserved. 1 Control Structures Outline Assignment Operators Increment and Decrement Operators Essentials of Counter-Controlled.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
1 Object-Oriented Programming -- Using C++ Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 4 - Program Control Outline 4.1Introduction 4.2The Essentials of Repetition 4.3Counter-Controlled.
EC-111 Algorithms & Computing Lecture #4 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1Introduction 2.2Algorithms 2.3Pseudocode 2.4Control Structures.
C++ Programming Lecture 6 Control Structure II (Repetition) By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 2 - Control Structures Outline 2.1Introduction 2.2Algorithms 2.3Pseudocode 2.4Control Structures.
1 Lecture 3 Control Structures else/if and while.
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 4 - Program Control Outline 4.1Introduction 4.2The Essentials of Repetition 4.3Counter-Controlled.
C++ Programming Lecture 7 Control Structure I (Selection) – Part II The Hashemite University Computer Engineering Department.
اسامي شناسه ها (Identifier names) اسامي متغيرها ، توابع ، برچسب ها (labels) وبقيه اشياء تعريف شده توسط كاربر در C ، شناسه ( identifier ) ناميده مي شود.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
شرط و تصميم اصول كامپيوتر 1. 2 الگوريتم اقليدس E1: [find remainder] Divide m by n and let r be the remainder. Clearly, 0
1/19 Informed search algorithms Chapter 4 Modified by Vali Derhami.
Department of Computer Eng. & IT Amirkabir University of Technology (Tehran Polytechnic) Data Structures Lecturer: Abbas Sarraf Order.
CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
 2003 Prentice Hall, Inc. All rights reserved. ECE 2551 Dr. S. Kozaitis Fall Chapter 5 - Control Statements: Part 2 Outline 5.3 for Repetition.
1 فصل سوم سينماتيك مستقيم. 2 محتواي فصل   تعريف مجموعه فازي   تابع عضويت   نمايش مجموعه هاي فازي   برش آلفا   متغيرهاي زباني   ساخت مجموعه.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Control Structures Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures.
1 Chapter 4 - Control Statements: Part 1 Outline 4.1 Introduction 4.4 Control Structures 4.5 if Selection Structure 4.6 if/else Selection Structure 4.7.
CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad.
Chapter 2 - Control Structures
Chapter 4 - Program Control
Chapter 2.1 Control Structures (Selection)
Control Statements Kingdom of Saudi Arabia
Chapter 2 - Control Structures
اصول کامپيوتر 1 – معرفي درس
مرتب سازي مقايسه اي مرتب سازي خطي
مبانی برنامه‌سازی با C++ جلسه دوم
آشنايي با برنامه نويسي به زبان C++
- Additional C Statements
مباني كامپيوتر و برنامه سازي Basics of Computer and Programming
نمايش اعداد در کامپيوتر چهار عمل اصلي
هیدرولیک جریان در کانالهای باز
Program Control Topics While loop For loop Switch statement
مثال : فلوچارتي رسم كنيد كه دو عدد از ورودي دريافت كرده بزرگترين عدد
Chapter 2 - Control Structures
Capitolo 2 - Control Structures
switch Selection Structure
Chapter 2 - Control Structures
2.6 The if/else Selection Structure
EPSII 59:006 Spring 2004.
Dale Roberts, Lecturer IUPUI
Chapter 4 - Program Control
Chapter 2 - Control Structures
C++ Programming Lecture 7 Control Structure I (Selection) – Part II
Presentation transcript:

دستورات کنترل و تکرار- 2 اصول كامپيوتر 1

ياد آوري: اجراي برنامه اجراي سريال کنترل اجرا و انتقال آن دستورات برنامه به ترتيبي که نوشته شده اند، اجرا مي شوند کنترل اجرا و انتقال آن زماني اتفاق مي افتد که دستور بعدي، دستور سريال بعدي نيست دستورات همه برنامه ها در قالب سه ساختارنوشته مي شوند دستورات سريال if, if-else, switch دستورات شرط و انتخابif, if-else, switch دستورات تکرار وحلقه while, do/while , for

تکرار با استفاده از شمارنده حلقه تا زماني تکرار مي شود که متغير شمارنده به مقدار خاصي برسد تکرار با شمارنده، تکرار معين است تعداد دفعات تکرار دستورات حلقه را مي توان فهميد مثال دريک کلاس 10 نفره امتحاني برگزار شده، ميانگين نمرات اين کلاس را تعيين کنيد:

تکرار با استفاده از شمارنده الگوريتم مثال Set total to zero Set grade counter to one While grade counter is less than or equal to ten Input the next grade Add the grade into the total Add one to the grade counter Set the class average to the total divided by ten Print the class average

برنامه مثال قبل int total; // sum of grades entered by user int gradeCounter; // number of the grades to be entered next int grade; // grade value entered by user int average; // average of grades // initialization phase total = 0; // initialize total gradeCounter = 1; // initialize loop counter // processing phase while ( gradeCounter <= 10 ){ // loop 10 times cout << "Enter grade: "; // prompt for input cin >> grade; // input next grade total = total + grade; // add grade to total gradeCounter = gradeCounter + 1; // increment counter by } // end while // termination phase average = total / 10; // integer division yields integer result // display total and average of grades cout << "\nTotal of all 10 grades is " << total << endl; cout << "Class average is " << average << endl; شمارنده حلقه در هر مرتبه يک واحد زياد مي شود و نهايتا به 10 مي رسد

تکرار با پرچم (نگهبان/قراول) مساله برنامه اي بنويسيد که ميانگين نمرات کلاس را محاسبه کند. تعداد دانشجويان کلاس در هربار اجراي برنامه ممکن است متفاوت از قبل باشد پرچم پايان ( قراول) پايان ورود داده ها را مشخص مي کند حلقه با ورود مقدار پرچم، پايان مي يابد مقدار پرچم بايد طوري انتخاب شود که با مقادير قابل قبول اشتباه نشود

طراحي بالا به پايين Top-Down Design شکل کلي مساله را در قالب شبه کد بيان کنيد: Determine the class average for the quiz اين شکل کلي را به مسايل کوچکتر بشکنيد: Initialize variables Input, sum and count the quiz grades Calculate and print the class average

طراحي بالا به پايين الگوريتم بدنه اغلب برنامه ها متشکل از سه فاز (بخش) است: آغازش يا آماده سازي: Initialization مقادير اوليه متغيرهاي برنامه تعيين مي شوند پردازش مقادير متغيرها از ورودي خوانده شده و اعمال لازم روي آنها انجام مي گيرد پايان نتايج نهايي محاسبه و چاپ مي شود طراحي بالا به پايين و تقسيم گام به گام بخش آغازش Initialize variables به Initialize total to zero Initialize counter to zero

تقسيم گام به گام تقسيم Input, sum and count the quiz grades Input the first grade (possibly the sentinel) While the user has not as yet entered the sentinel Add this grade into the running total Add one to the grade counter Input the next grade (possibly the sentinel) Calculate and print the class average If the counter is not equal to zero Set the average to the total divided by the counter Print the average Else Print “No grades were entered”

مثال: تکرار نا معين cout << "Enter grade or -1 to quit: "; cin >> grade; while ( grade != -1 ){ total = total + grade; gradeCounter = gradeCounter + 1; cout << "Enter grade or -1 to quit: "; } // end while

ساختارهاي کنترلي تو در تو مساله: موسسه اي نتيجه قبولي دانشجويانش(10 نفر) را منتشر کرده است. برنامه اي بنويسيد که اگر 8 نفر يا بيشتر قبول شده باشند، پيغام ”شهريه را افزايش دهيد“ چاپ شود. نتيجه هر نفر با 1 (قبول) يا 2( مردود) تعيين مي شود مي توان ديد که: الف: برنامه نتيجه 10 نفر را پردازش مي کند پس يک حلقه باشمارنده مي توان ساخت مي توان از دو شمارنده استفاده کرد: يکي براي شمردن تعداد دانشجويان و ديگري براشمردن تعداد مردودين. نتيجه هردانشجو 1 يا 2 است. اگر 1 نبود ، فرض مي کنيم 2 است بيان سطح بالاي مساله Analyze exam results and decide if tuition should be raised

ساختارهاي کنترلي تو در تو اولين تقسيم Initialize variables Input the ten quiz grades and count passes and failures Print a summary of the exam results and decide if tuition should be raised تقسيم به Initialize passes to zero Initialize failures to zero Initialize student counter to one

ساختارهاي کنترلي تو در تو تقسيم Input the ten quiz grades and count passes and failures به While student counter is less than or equal to ten Input the next exam result If the student passed Add one to passes Else Add one to failures Add one to student counter Print a summary of the exam results and decide if tuition should be raised Print the number of passes Print the number of failures If more than eight students passed Print “Raise tuition”

1. Initialize variables 2. Input data and count passes/failures 1 // Fig. 2.11: fig02_11.cpp 2 // Analysis of examination results 3 #include <iostream> 4 5 using std::cout; 6 using std::cin; 7 using std::endl; 8 9 int main() 10 { 11 // initialize variables in declarations 12 int passes = 0, // number of passes 13 failures = 0, // number of failures 14 studentCounter = 1, // student counter 15 result; // one exam result 16 17 // process 10 students; counter-controlled loop 18 while ( studentCounter <= 10 ) { 19 cout << "Enter result (1=pass,2=fail): "; 20 cin >> result; 21 22 if ( result == 1 ) // if/else nested in while 23 passes = passes + 1; 1. Initialize variables 2. Input data and count passes/failures

3. Print results Program Output 24 else 25 failures = failures + 1; 26 27 studentCounter = studentCounter + 1; 28 } 29 30 // termination phase 31 cout << "Passed " << passes << endl; 32 cout << "Failed " << failures << endl; 33 34 if ( passes > 8 ) 35 cout << "Raise tuition " << endl; 36 37 return 0; // successful termination 38 } 3. Print results Program Output Enter result (1=pass,2=fail): 1 Enter result (1=pass,2=fail): 2 Passed 9 Failed 1 Raise tuition

عملگرهاي مختصر انتساب عبارات انتسابيc = c + 3; را مي توان به صورت c += 3; نوشت عبارتي به شکل کلي variable = variable operator expression; را مي توان به شکل variable operator= expression; چند مثال: d -= 4 (d = d - 4) e *= 5 (e = e * 5) f /= 3 (f = f / 3) g %= 9 (g = g % 9)

عملگرهاي افزايش و کاهش مي توان به جاي c= c+1 از عملگر ++ استفاده کرده و چنين نوشت: c++ به همين ترتيب مي توان c-- را به جاي c -=1 بکاربرد Preincrement عملگر قبل از متغير قرار مي گيرد (++c or --c) ابتدا مقدار متغير تغيير مي کند و سپس عمل خواسته شده روي آن انجام مي گيرد Posincrement عملگر بعد از متغير قرار مي گيرد (c++ or c--) عمل خواسته شده روي متغير انجام مي گيرد، سپس مقدار آن تغيير مي کند اگر مقدار فعلي متغير c برابر 5 باشد: دستور cout << ++c عدد 6 را چاپ مي کند. ابتدا مقدار c افزايش يافته و سپس چاپ مي شود. دستور cout << c++ عدد 5 را چاپ مي کند. ابتدا مقدار c چاپ شده و سپس افزايش مي يابد.

عملگرهاي افزايش و کاهش اگر متغير در عبارتي استفاده نشده باشد، Preincrement و Postincrementاثر مشابهي دارند: ++c; cout << c; and c++;

ملزومات تکرار با شمارنده ملزومات تکرار با شمارنده: متغير اختصاصي براي شمارنده مقدار اوليه متغير شرطي که اتمام حلقه را بر اساس مقدار شمارنده بررسي کند عمل افزايش يا کاهش شمارنده که در هر بار اجراي حلقه اجرا مي شود مثال: int counter =1; //initialization while (counter <= 10){ //repetition condition cout << counter << endl; ++counter; //increment }

ملزومات تکرار با شمارنده تعريف int counter = 1; متغير counter را تعريف مي کند تعيين مي کند نوع آن integer است بخشي از حافظه کامپيوتر را به اين متغير اختصاص مي دهد مقدار آغازين آن را برابر 1 قرار مي دهد

حلقه تکرار for شکل کلي حلقه تکرار for چنين است مثال: for ( initialization; LoopContinuationTest; increment ) statement مثال: for( int counter = 1; counter <= 10; counter++ ) cout << counter << endl; اعداد از 1 تا 10 را چاپ مي کند   No semicolon after last statement

حلقه تکرار for حلقه for را مي توان با حلقه while بسادگي جايگزين کرد: initialization; while ( loopContinuationTest){ statement increment; } مي توان چندين دستور را در بخش آغازش حلقه و بخش بروز رساني نوشت: for (int i = 0, j = 0; j + i <= 10; j++, i++) cout << j + i << endl;

حلقه تکرار for - مثال Program to sum the even numbers from 2 to 100 1 // Fig. 2.20: fig02_20.cpp 2 // Summation with for 3 #include <iostream> 4 5 using std::cout; 6 using std::endl; 7 8 int main() 9 { 10 int sum = 0; 11 12 for ( int number = 2; number <= 100; number += 2 ) 13 sum += number; 14 15 cout << "Sum is " << sum << endl; 16 17 return 0; 18 }   Sum is 2550

ساختار انتخاب switch استفاده از اين دستور زماني مفيد است که چندين مقدار مختلف يک عبارت مورد نياز باشند true false . case a case a action(s) break case b case b action(s) case z case z action(s) default action(s)  

2.1 Use switch loop to update count 1 // Fig. 2.22: fig02_22.cpp 2 // Counting letter grades 3 #include <iostream> 4 5 using std::cout; 6 using std::cin; 7 using std::endl; 8 9 int main() 10 { 11 int grade, // one grade 12 aCount = 0, // number of A's 13 bCount = 0, // number of B's 14 cCount = 0, // number of C's 15 dCount = 0, // number of D's 16 fCount = 0; // number of F's 17 18 cout << "Enter the letter grades." << endl 19 << "Enter the EOF character to end input." << endl; 20 21 while ( ( grade = cin.get() ) != EOF ) { 22 23 switch ( grade ) { // switch nested in while 24 25 case 'A': // grade was uppercase A 26 case 'a': // or lowercase a 27 ++aCount; 28 break; // necessary to exit switch 29 30 case 'B': // grade was uppercase B 31 case 'b': // or lowercase b 32 ++bCount; 33 break; 34 1. Initialize variables 2. Input data 2.1 Use switch loop to update count Notice how the case statement is used

2.1 Use switch loop to update count 3. Print results 35 case 'C': // grade was uppercase C 36 case 'c': // or lowercase c 37 ++cCount; 38 break; 39 40 case 'D': // grade was uppercase D 41 case 'd': // or lowercase d 42 ++dCount; 43 break; 44 45 case 'F': // grade was uppercase F 46 case 'f': // or lowercase f 47 ++fCount; 48 break; 49 50 case '\n': // ignore newlines, 51 case '\t': // tabs, 52 case ' ': // and spaces in input 53 break; 54 55 default: // catch all other characters 56 cout << "Incorrect letter grade entered." 57 << " Enter a new grade." << endl; 58 break; // optional 59 } 60 } 61 62 cout << "\n\nTotals for each letter grade are:" 63 << "\nA: " << aCount 64 << "\nB: " << bCount 65 << "\nC: " << cCount 66 << "\nD: " << dCount 67 << "\nF: " << fCount << endl; 68 69 return 0; 70 } break causes switch to end and the program continues with the first statement after the switch structure. 2.1 Use switch loop to update count 3. Print results Notice the default statement.

Program Output Enter the letter grades. Enter the EOF character to end input. a B c C A d f E Incorrect letter grade entered. Enter a new grade. D b   Totals for each letter grade are: A: 3 B: 2 C: 3 D: 2 F: 1 Program Output

حلقه تکرار do/while حلقه تکرار do/while مشابه حلقه whiles است true false action(s) condition حلقه تکرار do/while مشابه حلقه whiles است شرط تکرار در پايان حلقه و پس از اجراي بدنه آن بررسي مي شود ساختار دستوري: do { statement } while ( condition ); مثال (فرض کنيد مقدار اوليه counter =1 ) cout << counter << " "; } while (++counter <= 10); اين حلقه اعداد از 1 تا 10 را چاپ مي کند همه دستورات حلقه حداقل يکبار اجرا مي شوند  

دستورات break Break با اجري اين دستور، برنامه بلافاصله از حلقه يا ساختار انتخاب خارج مي شود اجراي برنامه از دستور بعد از حلقه يا ساختار انتخاب ادامه مي يابد. در اين درس مجاز نيستيد از اين دستور استفاده کنيد، مگر در شرايط خاص که صريحا گفته شود

دستور continue Continue با استفاده از اين دستور، اجراي تکرار فعلي حلقه پايان يافته و تکرار بعدي آن شروع مي شود. در اين درس تحت هيچ شرايطي مجاز به استفاده از اين دستور نيستيد

عملگرهاي منطقي && (logical AND) || (logical OR) Returns true if both conditions are true || (logical OR) Returns true if either of its conditions are true ! (logical NOT, logical negation) نتيجه عبارت شرطي را معکوس مي کند عملگر تکي است. يعني روي يک عملوند عمل مي کند جدول ارزش ترکيب گزاره ها Expression Result true && false false true || false true !false true

عملگر تساوي: == و انتساب: = اغلب برنامه نويسان به اشتباه اين دو را به جاي هم استفاده مي کنند. اين اشتباه خطاي کامپايل توليد نمي کند، زيرا: هر عبارتي که حاصلي توليد کند مي تواند در دستورات شرط و کنترل استفاده شود مقدار صفر برابر false و مقدار غير صفر برابر true ارزيابي مي شود مثال: if ( payCode == 4 ) cout << "You get a bonus!" << endl; If == was replaced with = if ( payCode = 4 ) cout << "You get a bonus!" << endl; Sets paycode to 4 4 is nonzero, so the expression is true and a bonus is awarded, regardless of paycode.

عملگر تساوي: == و انتساب: = Lvalues عباراتي هستند که در سمت چپ عملگر انتساب قرار مي گيرند مقدار آنها قابل تغيير است متغيرها مثال خوبي از اين دسته اندx=4 Rvalues عباراتي هستند که تنها در سمت راست عملگر انتساب قابل استفاده اند ثابتها مثال خوبي از اين دسته اند pi=3.1515; Lvalue را ميتوان به جاي rvalue استفاده کرد اما برعکس آن ممکن نيست

برنامه نويسي ساخت يافته روش تقسيم مساله بزرگ مذکور در اينجا به برنامه نويسي ساختيافته مشهور است تغيير، تست و اشکال زدايي برنامه هاي ساختيافته آسان است قواعد برنامه نويسي ساختيافته ساختهاي کنترلي استفاده شده در برنامه يک نقطه ورودي و يک نقطه خروجي دارند. single-entry, single-exit روش برنامه نويسي با ساده ترين فلوچارت شروع کنيد و هر کدام از عمليات اصلي را با يک مستطيل نشان دهيد هر مستطيل را مي توانيد به چند مستطيل براي نشان دادن دستورات سريال تبديل کنيد هر مستطيل را مي توانيد با يک ساختار کنترلي جايگزين کنيد قوانين 2و 3را به ترتيب و تعداد لازم روي برنامه خود اعمال کنيد تا جزئيات برنامه به حد کافي روشن شده باشد    

برنامه نويسي ساخت يافته Rule 3

برنامه نويسي ساخت يافته همه برنامه ها را مي توان به بخشهاي کوچکتري تقسيم کرد Sequence سريال Selection انتخاب if, if/else, or switch هر انتخابي را مي توان با دستور if پياده سازي کرد Repetition تکرار while, do/while or for هر نوع دستور تکرار مي توان با while پياده سازي کرد.

تمرين با استفاده از دستورات کنترل و تکرار، برنامه اي بنويسيد که عدد طبيعي N‌را دريافت کند و سپس آن را به صورت حاصلضرب مقسوم عليه هاي اولش نمايش دهد. مثال 100 = 2*2*5*5