100% found this document useful (1 vote)
353 views

Algorithm & Flowchart

The document contains algorithms and flowcharts for calculating the area of a circle, checking if a number is positive or negative, calculating the sum of n numbers, checking if a number is prime, and finding the factors of a number. Each algorithm uses a step-by-step process and each flowchart shows the logic graphically using symbols.

Uploaded by

Anas Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
353 views

Algorithm & Flowchart

The document contains algorithms and flowcharts for calculating the area of a circle, checking if a number is positive or negative, calculating the sum of n numbers, checking if a number is prime, and finding the factors of a number. Each algorithm uses a step-by-step process and each flowchart shows the logic graphically using symbols.

Uploaded by

Anas Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Anam Shaikh Roll No.

163 Grp: 4
Algorithm & Flowchart of Area of Circle
*Algorithm
1} Start

2} Accept the radius r from user

3} Calculate Area=3.142*(r*r)

4} Print Area of circle

5} Stop

*Flowchart
Start

Accept r

Calculate
Area=3.142*(r*r)

Print Area

Stop
Algorithm & Flowchart for To Check the
number Positive or Negative
*Algorithm
1} Start

2} Accept the number n

3} If(n>0) then print n is a positive number

Else

Print n is a negative number

4} Stop

*Flowchart
Start

Accept n

If

yes no

Print n is positive Print n is negative


number number

Stop
Algorithm & Flowchart for Sum of n
Number
*Algorithm
1} Start

2} Accept the value of n

3} Initialize i=0 & sum=0

4} if (i>n) go to step 8

5} sum=sum+i

6} i=i+1
Start
7} go to step 4

8} Display the value of sum


Accept n
9} Stop

*Flowchart Initialize i=0 sum=0

If(i>n) yes

no
sum=sum+i i=i+1

Print value of sum

Stop
Algorithm & Flowchart for finding a
number Prime or not
*Algorithm
1} Stop

2} Initialize i=2 & p=2

3} Accept the number n

4} Check (n%i==0) if true continue

Else

Go to step 6

5} p=1

6} Increment the value of i means i++

7} Check (i<n) if true go to step 4

8} Check (p==0 or n=2) then continue

Else

Go to step 11

9} Print the given number is prime

10} Go to step 12

11} The number is not prime

12} Stop
start
*Flowchart
i=2 , p=2

Accept n

p=1 Check

i=i+1

I<n

P==0 or n=2

no yes
Print number is not prime Print number is prime

stop
Algorithm & Flowchart for Factors of a
number
*Algorithm
1} Start

2} Accept n

3} check whether i=num reached? If true then go to step 6

Else go to step 4

4} if(n%i==0) is true then print i

Else go to step 5

5} compute i=i+1 then go to step 3

6) stop Start

Accept n

*Flowchart
yes
Whether i=num
reached?

no
If (n%i==0)

Print i

Compute i=i+1

Stop

You might also like