Algo & Flowchart PDF
Document Details
Uploaded by Deleted User
VijaySir
Tags
Summary
This document provides algorithms and flowcharts for various programming tasks, including finding factorials, Armstrong numbers, maximum numbers (from 2 or 3 inputs), odd/even numbers, and even numbers in a given range. These algorithms are presented in step-by-step instructions and flowcharts.
Full Transcript
CPPM Unit 1 bitZarna Q1 ) Write an algorithm and draw flowchart to find Factorial of given number. Algorithm: Step 1 : Start. Step 2 : Read n. Step 3 : Initialize counter variable i=1 and fact=1. Step 4 : if i 0) then goto step 5. Otherwise goto step 7 S...
CPPM Unit 1 bitZarna Q1 ) Write an algorithm and draw flowchart to find Factorial of given number. Algorithm: Step 1 : Start. Step 2 : Read n. Step 3 : Initialize counter variable i=1 and fact=1. Step 4 : if i 0) then goto step 5. Otherwise goto step 7 Step 7 : if(sum==temp) then display no is Armstrong number otherwise goto step 9 Step 8 : Stop. Step 9 : no is not Armstrong. Step 10 : Stop Prepared By : VijaySir Page 2 CPPM Unit 1 bitZarna Prepared By : VijaySir Page 3 CPPM Unit 1 bitZarna Write an algorithm to find maximum number from three numbers. Step 1 : Start Step 2 : Input a, b, c Step 3 : if a > b goto step 4, otherwise goto step 5 Step 4 : if a > c goto step 6, otherwise goto step 8 Step 5 : if b > c goto step 7, otherwise goto step 8 Step 6 : Output "a is the largest", goto step 9 Step 7 : Output "b is the largest", goto step 9 Step 8 : Output " c is the largest", goto step 9 Step 9 : Stop Prepared By : VijaySir Page 4 CPPM Unit 1 bitZarna Prepared By : VijaySir Page 5 CPPM Unit 1 bitZarna Write an Algorithm to find out whether the given number is odd or even. Step 1: start Step 2: read no Step 3: if no%2==0 go to step 4, otherwise goto step 5 Step 4: print no is even, go to step6 Step 5: print no is odd, go to step 6 Step 6:stop Prepared By : VijaySir Page 6 CPPM Unit 1 bitZarna Write algorithm to find maximum number from two numbers. Step1: start Step 2: read a,b Step 3: if a>b go to step 4,otherwise goto step 5 Step 4: print a is maximum, goto step 6 Step 5: print b is maximum, goto step 6 Step 6:stop Prepared By : VijaySir Page 7 CPPM Unit 1 bitZarna Write an algorithm to find even numbers from 1 to N. Here, N is input from keyboard. Step1: start Step 2: read value of N Step 3: initialize i=1 Step 4: if i