Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask Arty Your Own Question

Arty, Computer Software Engineer

Category: Programming

Satisfied Customers: 575

Experience: 15+ years of programming, C, C++, Java, PHP, awk, ruby, shell, ASM, Forth, Raptor, M.A.R.I.E, Excel

31145473

Type Your Programming Question Here...

Arty is online now

I want a pseudo code for the following 1) A pseudo to write

Resolved Question:

I want a pseudo code for the following:

1) A pseudo to write a program that can solve simultaneous equation of two variables 2) Pseudo to write a program that will add 2 matrices together 3) Pseudo code to write a program to subtract two matrices 4) pseudo code to write a program that can solve a quadratic equation.

Please, Its on Qbasic that I want to write the program, so the pseudo code should be one that i can use on Qbasic.

Algorithms can be expressed with pseudo-code. But they can also be written in simple words. Here is an analysis and algorithm.

1) Analysis.

To solve a linar equation, like this:

where a11, a12, a21, a22, b1, b2 - some fixed numbers and x1, x2 are unknowns,

one should use this formula:

to find X1:

to find X2:

The divisor can't be zero:

So we should check the divisor first, then try to find values.

The algorithm is:

- ask user to input known coefficients: a11, a12, a21, a22, b1, b2

- calculate D, that is a11*a22 - a12*a21

- if D is zero - the equation can't be solved

- if D is non zero - calculate x1 and x2 according to the above formula

2) Analysis.

Only matrices of the same dimentions can be added. Let N is a number of rows, M is a number of columns. Sum of matrices A and B is a matrix C, that has the same dimentions NxM and in the position of any row i and column j there is a sum of corresponding elements (i,j) of matrices A and B.

so the algorithm is:

- create matrix C with the same dimentions as A and B

- for every row and column of matrix C set element to be equal the sum of appropriate elements of A and B, i.e. C(row, column) = A(row, column) + B(row, column)

3) Subtraction of matrices is basically the same as addition. C(row, column) = A(row, column) - B(row, column).

4) Quadratic equation looks like:

a*X^2 + b*X +c = 0

a, b and c are numbers, X is unknown variable

there is a known formula to calculate unknown X:

X = (-b +/- SquareRoot(b^2 - 4*a*c))/(2*a)

This equation may have 1, 2 or 0 solutions depending on this expression value: (b^2 - 4*a*c). If it is equal to 0, there is only one solution:

X=(-b)/2*a

If it is below zero - there are no solutions

If it is above zero - there are 2 solutions

X= (-b + SquareRoot(b^2 - 4*a*c))/(2*a)

and

X= (-b - SquareRoot(b^2 - 4*a*c))/(2*a)

Algorithm.

- ask user to enter a, b and c

- calculate d = (b^2 - 4*a*c)

- if d<0 print a message that there are no solutions

- if d=0 print a message that there is only 1 solution, X=-B/(2*a)

- if d>0 print a message that there are 2 solutions: X=(-B+square_root(D))/(2*a) and X=(-B-square_root(D))/(2*a)