Prompt the user to enter a linear equation of the form

Assignment Help Computer Engineering
Reference no: EM132158174

ONLY USE #include <stdio.h> and <math.h>

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:

I 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.

I 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.

I 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.

I 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.

I Print the value of Y that solves the equation with three digits of accuracy after the decimal point.

Reference no: EM132158174

Questions Cloud

Identify and discuss one disadvantage or possible downside : What are the benefits? Identify and discuss one disadvantage or possible downside.
Create a bookfactory to construct the required object : Create a BookFactory to construct the required object and use the enum Books. Use virtual functions to read and print the data.
Discuss how the development of a mental health policy : Discuss how the development of a mental health policy might decrease the stigma attached to mental health disorders.
Write a python program that prompts for an integer : Write a Python Program that prompts for an integer and prints the integer, but if something other than an integer is input, the program keeps asking.
Prompt the user to enter a linear equation of the form : 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.
Have all invested in global seed banks : Very different organisations, such as governments, industry, and environmental agencies, have all invested in global seed banks.
Has there been evolution in this population : Has there been evolution in this population? If yes, is natural selection involved? Explain and justify the answers.
Write java gui program to update this file : Use java GUI JFileChooser to locate lab.txt from the file directory and use JTextArea to update the file.
Determine the expected frequency of colour : If 15% of men in a population are colour blind, determine the expected frequency of colour blind women in this same population.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd