A Computer program is an algorithm. Explain? Write an algorithm to find the sum of N even numbers
Algorithm is a prescribed set of well-defined, unambiguous rules or processes for the solution of a problem in a finite number of steps.
Computer programs are also a set of well defined instructions to solve any type of problems in definite language.
STEP 1 Input Total Numbers
Initialize Counter
Initialize Number
Initialize Sum
STEP 2 Input First Number
Add the Number to Sum
Increase The Counter
Check counter = total numbers
If counter < Total Numbers Repeat
Step 2 If counter Total Numbers then stop
Algorithm is a prescribed set of well-defined, unambiguous rules or processes for the solution of a problem in a finite number of steps.
Computer programs are also a set of well defined instructions to solve any type of problems in definite language.
STEP 1 Input Total Numbers
Initialize Counter
Initialize Number
Initialize Sum
STEP 2 Input First Number
Add the Number to Sum
Increase The Counter
Check counter = total numbers
If counter < Total Numbers Repeat
Step 2 If counter Total Numbers then stop
No comments:
Post a Comment