Table of Contents
How do you write pseudocode to find the roots of a quadratic equation?
Pseudo Code Algorithm:
- Start.
- Input a, b, c.
- D ← sqrt (b × b – 4 × a × c).
- X1 ← (-b + d) / (2 × a).
- X2 ← (-b – d) / (2 × a).
- Print x1, x2.
- Stop.
How do you use an algorithm to solve a quadratic equation?
Algorithm to find all the roots of a quadratic equation
- Input the value of a, b, c.
- Calculate k = b*b – 4*a*c.
- If (d < 0) Display “Roots are Imaginary, calculater1 = (-b +i? k)/ 2a and r2 =(b + i? k)/ 2a. else if (d = 0) Display “Roots are Equal” and calculate r1 = r2 = (-b / 2*a)
- Print r1 and r2.
- End the algorithm.
Is quadratic formula an algorithm?
An algorithm is a method for solving a problem, but a formula is a sequence of numbers and symbols corresponding to a word in a language. The quadratic formula is an algorithm, because it is a method for solving quadratic equations. Algorithms may not even involve math, but formulas almost exclusively use numbers.
How do you write pseudocode for an algorithm?
Writing in pseudocode is similar to writing in a programming language. Each step of the algorithm is written on a line of its own in sequence. Usually, instructions are written in uppercase, variables in lowercase and messages in sentence case. In pseudocode, INPUT asks a question.
What is a pseudocode in C?
Pseudo code in C is a simple way to write programming code in English. It uses short or simple English language syntax to write code for programs before it is converted into a specific programming language.
How do you write pseudocode algorithm?
Rules of writing pseudocode
- Always capitalize the initial word (often one of the main 6 constructs).
- Have only one statement per line.
- Indent to show hierarchy, improve readability, and show nested constructs.
- Always end multiline sections using any of the END keywords (ENDIF, ENDWHILE, etc.).