I did a quick Google Search:

__ax b = 0 - Google Search__[^] and found this:

__How do you solve for x in ax+b=0? | Socratic__[^]

Now you can write the code...

See more:

i hate to rite a program that determines the solution of a degree 1 equation with real coefficients, of the form ax+b = 0

i wrote

i dont think is correct to write result=a*x + b =0 ; but i dont know how to write the right algorithm.

**What I have tried:**

i m new to programming sorry i need some help

i wrote

#include <stdio.h> int main(){ int a , b , x ,result; scanf("%d %d %d", &a ,&b ,&x); result = a*x + b = 0; printf("The solution is %d" , ); return 0; }

i dont think is correct to write result=a*x + b =0 ; but i dont know how to write the right algorithm.

i m new to programming sorry i need some help

This sounds like a homework assignment... I will get you started on how to solve the equation:

I did a quick Google Search:__ax b = 0 - Google Search__[^] and found this: __How do you solve for x in ax+b=0? | Socratic__[^]

Now you can write the code...

I did a quick Google Search:

Now you can write the code...

Permalink

Share this answer

Quote:i hate to rite a program

I suppose it is "I have to write".

you are writing a question for others, make it clear. Pay attention to spelling.

Quote:determines the solution of a degree 1 equation with real coefficients, of the form ax+b = 0

Read carefully the requirement !

In this case, you want to find x.

C++

`result = a*x + b = 0;`

The language will not guess what you want to do. This code is correct c, but it have another meaning.

The requirement wants you to find the mathematics to solve the equation by hand, and then translate this mathematic to a program.

Permalink

Share this answer

Quote:determines the solution of a degree 1 equation with real coefficients, of the form ax+b = 0

As Patrice has already pointed out, this type of task usually looks for a solution for the variable x. So you have to read in a and b and rearrange the formula so that the value for x comes out as the result.

Permalink

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900