what does \n and %d mean?
Here, in C programming \n is an escape character that helps to create a new line whereas %d is a format specifier that allows to specify only Integer values.
What are algorithms and flowcharts? Differentiate between them.
An algorithm is defined as a finite sequence of explicit instructions that produces an output with the set of input values. The steps in the algorithm are never ambiguous. It terminates after a finite number of steps. Algorithms can have repetitions and logical decisions until a specific task is completed. Algorithms are not computer programs. They cannot be executed by the computer.
A flowchart is a diagram showing a sequence of events that describes the activities necessary to the solution to a problem. It is drawn using a set of conventional symbols. The symbols are connected by the arrowhead that indicates the order in which activities will occur.
The difference between Algorithm and Flowchart
S.N | Algorithm | Flowchart |
---|---|---|
1. | Algorithm is step by step procedure to solve the problem. | Flowchart is a diagram created by different shapes to show the flow of data. |
2. | Algorithm is complex to understand. | Flowchart is easy to understand. |
3. | In algorithm plain text are used. | In flowchart, symbols/shapes are used. |
4. | Algorithm is easy to debug. | Flowchart it is hard to debug. |
5. | Algorithm does not follow any rules. | Flowchart follows rules to be constructed. |
6. | Algorithm is the pseudo code for the program. | Flowchart is just graphical representation of that logic. |