Introduction to FlowChart:-
Before understanding the flowchart, we have to understood about the algorithms.
An algorithm is a formula, a recipe, a step-by-step procedure to be followed in order to obtain the solution to a problem. The algorith must:-
A program flowchart is a pictorial representation of logic required to accomplish a task, it includes all necessary steps of a program.
FlowChart Symbols :-
The flowchart will always build by theses symbols.
Q.1. Draw a flow chart to input two numbers and print their sum.
Ans.1.
Before understanding the flowchart, we have to understood about the algorithms.
An algorithm is a formula, a recipe, a step-by-step procedure to be followed in order to obtain the solution to a problem. The algorith must:-
- arrive at correct solution within a finite time
- be clear, precise , unambiguous and
- be in a format which lends itself to an elegant implementation in a programming language.
A program flowchart is a pictorial representation of logic required to accomplish a task, it includes all necessary steps of a program.
FlowChart Symbols :-
The flowchart will always build by theses symbols.
Q.1. Draw a flow chart to input two numbers and print their sum.
Ans.1.
the above figure is a flow chart of addition of two numbers. The concept of addition of two numbers will be remain same but we can design this in any programming language like C, C++, Java etc. In this figure arrows are showing the flow of the program. So if we interpret it, we will say first of all the user should accept two numbers as N1,N2 (for example we will take 10 and 20 in n1 and n2 respectively) then next step will add both the numbers and store the sum of the above in the variable sum(according to the above values it will be 30). The next step will print the value of sum(30 on the console output device like screen) and then program will be stopped.
Program using C
#include<stdio.h>
void main()
{
int n1,n2,sum;
printf("enter any two numbers");
scanf("%d%d",&n1,&n2);
sum=n1+n2;
printf("the sum of two number %d , %d is = %d",n1,n2,sum);
}
Program using C++
#include<iostream.h>
void main()
{
int n1,n2,sum;
cout <<"enter any two numbers";
cin >>n1>>n2;
sum=n1+n2;
cout <<"The sum of two number <<n1<<","<<n2 <<"is = "<<sum;
}
Program using Java
import java.util.Scanner;
class sum
{
public static void main(String args[])
{
int n1,n2,sum;
System.out.println("enter any two numbers");
Scanner in = new Scanner(System.in);
n1=in.nextInt();
n2=in.nextInt();
sum=n1+n2;
System.out.println("The sum of two number "+n1+" , "+n2 +" is = "+sum);
}
}
class sum
{
public static void main(String args[])
{
int n1,n2,sum;
System.out.println("enter any two numbers");
Scanner in = new Scanner(System.in);
n1=in.nextInt();
n2=in.nextInt();
sum=n1+n2;
System.out.println("The sum of two number "+n1+" , "+n2 +" is = "+sum);
}
}


