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. The computer then "executes" the
program, following each step to accomplish the end goal.
When you are telling the computer what to do, you also get to choose how it's going to do it. That's where computer algorithms come in .
An algorithm is a set of instructions, sometimes called a procedure or a function, that is used to perform a certain task. This can be a simple process, such as adding two numbers together, or a complex function, such as adding effects to an image.
Here is an algorithm show step by step how to add two numbers entered by user :
step 1:start
step 2:declare variables num1,num2,sum
step 3: read values num1 and num2
step 4:add num1 and num2 and assign the result to sum. sum=num1+num2
step 5: display sum
step 6:stop
When you are telling the computer what to do, you also get to choose how it's going to do it. That's where computer algorithms come in .
An algorithm is a set of instructions, sometimes called a procedure or a function, that is used to perform a certain task. This can be a simple process, such as adding two numbers together, or a complex function, such as adding effects to an image.
Here is an algorithm show step by step how to add two numbers entered by user :
step 1:start
step 2:declare variables num1,num2,sum
step 3: read values num1 and num2
step 4:add num1 and num2 and assign the result to sum. sum=num1+num2
step 5: display sum
step 6:stop
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop - See more at: http://www.programiz.com/article/algorithm-programming#sthash.2WL5JVex.dpuf
to add two numbers entered by user
to add two numbers entered by user
0 commentaires:
Post a Comment