write an algorithm to find the greater number between two number
Answers
Answer:
Algorithm, Flowchart and Program code to print the larger of two numbers
- Step 1: Start.
- Step 2: Read a, b . / * a, b two numbers */
- Step 3: If a>b then /*Checking */
- Display “a is the largest number”.
- Otherwise.
- Display “b is the largest number”.
First, declare the variable for two numbers a & b. If a > b, A is the biggest Print "A is Biggest". else print "B is Biggest".
An algorithm to find the greater number between two numbers :
⇒ Start creating a variable named biggest to store the largest number, assuming the numbers are entered one after the other.
⇒ Change the variable "biggest" to that integer when the very first integer is entered.
⇒ Check to determine if the next number is greater than the variable stored in "biggest" because the next integer is entered.
⇒ If the number entered is bigger, the biggest value is equal to the number entered.
⇒ The biggest number will be the one saved in "largest" once the two numbers have been entered.
ALGORITHM :
Step 1: START
Step 2: Declare variables a, b.
Step 3: If a > b go to step 4 otherwise go to step 5
Step 4: If A is the biggest Print "A is Biggest"
Step 5: else print "B is Biggest"
Step 6: STOP