To make a computer do anything you have to write a computer program. To write a computer program you have to tell the computer, step by step exactly what you want it to do.
An Algorithm can be defined as the set of rules and sequential steps that define how a particular problem can be solved in finite and ordered sequence. An Algorithm written in a computer is called a program. Simply speaking an Algorithm is called the heart of programing. An Algorithm describes a method by which a given task is accomplished.
A Flow Chart is the pictorial representation in which symbols are used to show the various operations and decisions to be followed in solving a problem.
FUNCTIONS OF ALGORITHMSAn Algorithm generally takes some input, carries out a number of effective steps in a finite amount of time, and produces some output CHARACTERISTICS OF ALGORITM1. UNAMBIGUOUS: It should state clearly what each line of the Algorithm does 2. DEFINITE AND EFFECTIVE: This implies the successful termination of the program. Thus every Algorithm should have the following characteristics 1. Input 2. Output 3. Definiteness 4. Effectiveness 5. Termination An Algorithm uses the words BEGIN start and END to end BEGIN(start of algorithm) Step1 Step2 Step3 …………. ………….. Step n END(END OF ALGORITHM)
An algorithm to print ten odd numbersInput : the start number Output: First ten odd numbers STEPS: 1. Let the first number be n 2. n =1 3. Print n 4. Count c =1 5. Add 2 to n 6. Add 1 to c 7. Is c > 10 : Go to step 5 8. Stop 9. End algorithm
An algorithm to print average of given sets of numbersInput: read the value of n where n is the total numbers we have Output: the average of numbers STEPS: 1. Read n 2. I =1, sum =0 3. If i>n go to 9 4. Read the value of X 5. SUM =SUM +x 6. I =I +1 7. Go to 3 8. Average = SUM/ n 9. Print Average 10. End
|
|
1. List and explain stages involved in program development
2. List examples of a compiled and interpreted program Student are allowed to give corrections to the assessment given by the teacher ,while the teacher support s them in order to guide them |
See also