0% found this document useful (0 votes)
5 views4 pages

Algorithms and Flowcharts Guide

The document outlines algorithms and flowcharts for four problems: exchanging values of two variables, counting from 1 to n, summation of a set of numbers, and factorial computation. Each problem includes a step-by-step algorithm and a corresponding flowchart for visual representation. The algorithms provide a clear method for solving each problem efficiently.

Uploaded by

rameshgowshik282
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Algorithms and Flowcharts Guide

The document outlines algorithms and flowcharts for four problems: exchanging values of two variables, counting from 1 to n, summation of a set of numbers, and factorial computation. Each problem includes a step-by-step algorithm and a corresponding flowchart for visual representation. The algorithms provide a clear method for solving each problem efficiently.

Uploaded by

rameshgowshik282
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Algorithms and Flowcharts

This document contains algorithms and flowcharts for


the following problems:
1. Exchanging the values of two variables
2. Counting from 1 to n
3. Summation of a set of numbers
4. Factorial computation
1. Exchanging the values of two variables
Algorithm:

1. Start
2. Input two variables A and B
3. Display the values of A and B before exchange
4. Set TEMP = A
5. Set A = B
6. Set B = TEMP
7. Display the values of A and B after exchange
8. Stop

Flowchart:

Start → Input A,B → TEMP=A → A=B → B=TEMP →


Display A,B → Stop
2. Counting from 1 to n
Algorithm:

1. Start
2. Input N
3. Set I = 1
4. While I ≤ N, do
Display I
Increment I by 1
5. Stop

Flowchart:

Start → Input N → I=1 → [I ≤ N?] → Yes → Display I →


I=I+1 → Back to check → No → Stop

3. Summation of a set of numbers


Algorithm:

1. Start
2. Input the value of N (total numbers)
3. Set SUM = 0 and I = 1
4. While I ≤ N, do
Input number X
SUM = SUM + X
I=I+1
5. Display SUM
6. Stop

Flowchart:

Start → Input N → SUM=0, I=1 → [I ≤ N?] → Yes → Input


X → SUM=SUM+X → I=I+1 → Back to check → No →
Display SUM → Stop

4. Factorial Computation
Algorithm:

1. Start
2. Input N
3. Set FACT = 1 and I = 1
4. While I ≤ N, do
FACT = FACT × I
I=I+1
5. Display FACT
6. Stop

Flowchart:

Start → Input N → FACT=1, I=1 → [I ≤ N?] → Yes →


FACT=FACT×I → I=I+1 → Back to check → No → Display
FACT → Stop

You might also like