The Beginning-contd.

Dear friends, Today we will explain the parts of the flowchart which I have introduced in the last post. The flowchart diagram is as follows.
Start :  Generally this part of the flowchart indicates, beginning of our program takes place. Typically it is a classic way of representation that execution of program started.

Initialisation : Whenever we approach through the program to achieve any work we use some standard way. For ex, we want to perform addition of two numbers. Generally what we do, take two numbers say 2 and 3 (for a case) then we directly calculate as 2+3=5 . For programming first we have to define some variables ( I will explain part of variables very soon) like A and B. Then we give two values to these variables as A=2 and B=3, and the sum of these numbers will be given to another variable say C as,
C= A+B, Finally we have C=5.
                        So to declare these variables we will have to give instructions for processor that use these variables for the summation of the two numbers. That is why Initialisation stage is very much important in C programming.

Input:  At this stage , the two values are taken from the user for addition purpose. Just like an calculator, which take two or more numbers and at the end preforms addition of the numbers that were given as Input. Therefore we need to declare the variables, because computer not already knows which numbers that we are giving to it.

Addition and Print :  When we get the two numbers from user, we have to perform addition. So in program we just have to give instruction C=A+B. We already know that after input stage A and B both variables get the values. After addition the value is assigned to C. Thus the final stage is to print the output. Please do not confuse with word 'print' it is not like print the output using printers on white paper. Here printing the output means just showing it on output screen. The appearance of output screen is shown in following picture

Just forget about what is this screen showing. I hope that now you will clear with print the output value on screen.

End : This is also classic way in flowchart to represent that the program is terminated.

Now I will give you a program.
#include<stdio.h>
void main() {

int A=2,B=3,C; // Initialisation
C=A+B; // Addition
printf("Output is %d",C); // print the output

}

Please do not worry for understanding this code, I will explain it line to line very soon.

++++++++++++++++++++++++++++++
Your life is printout of your thoughts.
                                    -Steve Maraboli 
++++++++++++++++++++++++++++++


              

No comments:

Post a Comment

Share English German French Arabic Chinese Simplified