Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program, called linear_solver.c, that solves single-variable linear eq

ID: 3616552 • Letter: W

Question

Write a C program, called linear_solver.c, that solves single-variable
linear equations. The program should prompt the user to enter a linear
equation of the form

                                     aY + b = c

where a,b, and c are real numbers of type double. The program should
then output the value of Y that solves the equation, if such a value
exists(see the note about verifying that a in nonzero). If the input
provided by the user is not valid, the program should terminate with
an appropriate error message.

Notes
The character Y should appear in the input as a capital letter.
Introduce this character into the program as a symbolic constant using
#define, as follows:

#define VARIABLE_NAME ' Y '
When reading the equation using scanf(), you can use the %c conversion
specification to read the character typed-in by the user, then compare
this character with VARIABLE_NAME.

There should be no spaces in the input between the number a and the
character Y. However, there may or may not be spaces around the + and
= characters.

If there is additional text after the equation, but the equation
itself is valid, ignore the additional text and solve the equation as
described above. For an example of this, see the second sample run.

Verify that the value of a is not zero. If this is not the case,you
should print an appropriate error message and terminate the program
using return 1. See the third sample run. Print the value of Y that
solves the equation with three digits of accuracy after the decimal
point.

Here are six sample runs of this program, assuming that the executable
file is called linear_solver.

Enter a linear equation: 3Y+5=2
Y = -1.000

Enter a linear equation: 2Y+ -12 = 0.5 bla blah...
Y= 6.250

Enter a linear equation: 0Y+2=1
Invalid equation!

Enter a linear equation: 2Y + 5 = 2
Invalid input!

Enter a linear equation: 3Y-2=1
Invalid input!

Enter a linear equation: 2y+12 = 0.5
Invalid input!

Problem2

An integer p> 1 is said to be prime if p is divisible only by 1 and by
p itself(strictly speaking, a prime p is divisible by +or - and + or -
p, but this is not relevant for the problem at hand). Every integer
n>1 can be written in a unique way as a product of primes in
nondecreasing order. The nondecreasing sequence of primes in this
product is called the prime factorization of n. Here are a few
examples:

. Since 6 = 2*3, the prime factorization of 6 is 2,3.
. Since 12=2*2*3, the prime factorization of 12 is 2,2,3.
. The prime factorization of 7 is 7.
. The prime factorization of 300300 is 2,2,3,5,5,7,11,13.

Write a C program, called prime_factorization.c, that prompts the user
to enter an integer and then prints its prime factorization. The
program should keep doing this repeatedly as long as the user enters
an integer greater than 1. If the user enters an integer less than or
equal to 1, the program should simply terminate. If the user enters a
non-integer, the program should terminate with an appropriate error
message. Here is one sample run of such a program, assuming that the
executable file is called prime_factorization.

Enter an integer: 75
The prime factorization of 75 is 3 5 5

Enter an integer: 18
The prime factorization of 18 is 2 3 3

Enter an integer: 17
The prime factorization of 17 is 17

Enter an integer: 1

Notes:
Print the prime factors in nondecreasing order, as in the sample run above.

If a prime factor appears in the factorization m times, it should
appear in the output m times as well. For example, in the sample run
above, 5 appears twice in the prime factorization of 75.

Verify successful execution of the input function. If its execution is
not successful, print an appropriation error message and terminate the
program using return 1.

Hints
You can use the following algorithm to compute the prime factorization
of an integer n>1.
Step 1. Initialize by setting i = 2.
Step 2. If i divides n, adjoin i to the prime factorization and set n=
n/i; else increase i by 1.
Step 3. If i > n terminate, otherwise go back to step2.

It is a good idea to convince yourself, first, that the foregoing
algorithm is correct. For your information, a list of the first few
prime numbers can be found at www. prime-numbers.org.

Problem3.

The ABRACADABRA language has just five lowercase letters a, b, c, d, r
and every combination of these letters(but no other letters) is a word
in the ABRACADABRA language. For example, abba is a word in the
language, but aBBa and abbe are not. The good people of ABRACADABRA
often en-crypt their words, so that they can send other messages which
their adversaries cannot understand. To this end, they use the
following simple encryption process, called a substitution cipher.

First consider the natural (or lexicographic) order of the five
letters, where a is the first letter, b is the second letter, and so
on, with r being the last letter. Two parties who wish to communicate
with each other agree in advance on a secret order of the five letters
in the language, also called the encrytion key(for example r,b,c,d,a).
To encrypt a message, they create a table consisting of two rows. The
first row lists the letters a, b, c, d, r in their natural order,
which the second row lists these same letters in the secret order of
the encryption key. Here is an example of such a table:

natural order    a   b   c   d   r
encryption key r   b   c    d a

An arbitrary word in the ABRACADABRA language can be now encrypted by
replacing every letter in the word by an encryp

Explanation / Answer

please rate - thanks CRAMSTER RULE 1 question per post problem 2 #include #include #include int main() {     int input,n;     printf("Enter an integer: ");     do     {scanf("%d",&input);      if(input
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote