Monday, October 29, 2018

Introduction to C Progamming

What is Algorithm?
An algorithm is a procedure to solve a problem in terms of actions to execute and the order of execution of these actions.



Below is an example of an Algorithm featuring eating

1.Wash hands
2. Take spoon and fork and plate
3. Put the food on the plate
4. Eat the food
5.Wash hands

Every people have their own style of eating, that applies to programming as well. Some people prefer using A style, while the others prefer using B style, regardless of what style they chose, the output will be the same. That's the beauty of Algorithm in programming.

Pseudo code=Pseudo code is a informal language that help everyone to understand what a programmer is trying to write.

Below is an example of a Pseudo Code

Start
input number1,number2,number3=0
print number1+ "+" + number2 + "=" + number1+number2
End

The program starts with inputting 2 number which is labeled as number1 and number2 and the output will be the addition result from number1 and number2.

Flow Chart=Flow Chart is an alternative way of pseudo codo that help people to understand what a programmer is trying to write by drawing structured symbol.


A algorithm is considered good when it has the element of the right logical flow, structure language, easy implementation, clear steps and operations.

Structure theorem for computer programming using only three control structures, namely
Sequence
Selection
Repetition

Sequence
The sequence is a series of consecutive commands / instructions. The programming language usually has a sequence of instructions from the top of the program to the bottom(the end).

Selection
The selection control structure is a structure that allows us to choose from several statement / command options.The first statement will be executed if the condition is fulfilled, otherwise the else statement will be executed.

Repetition
Repetition structured control can be used to repeat a number of statements/commands multiple times.


By :Steven
2201852132
Computer Science and Statistics







No comments:

Post a Comment