Computer Science, asked by kohana93, 11 months ago

write an algorithm to accept two numbers.If two numbers are equal then find the sum otherwise, the product

Answers

Answered by rakeshchennupati143
47

Algorithm:

  1. start
  2. initialize two variables a,b as int
  3. input a,b, value from the user
  4. start if a is equal to b the initialize sum as int
  5. add a and b,store the value in sum variable
  6. print sum
  7. else initialize product as int
  8. multiply a with b and store the result in product variable
  9. print product
  10. end if condition
  11. end program

----Hope you got- what you wanted, if you liked my algorithm,mark as brainliest, it would really help me.   :)

Answered by monica789412
6

Following are the steps of algorithm is required to accept two numbers and if they are equal then find the sum otherwise the product.

Algorithm:

  • Start
  • Initialize n1 and n2 as two integer variables.
  • Accept the value of n1 and n2.
  • check if

          n1==n2

          Initialize the sum as integer variable

          sum=n1+n2

          print sum

  • else

          Initialize the product as integer variable

          product=n1*n2

          print product

  • Stop
Similar questions