Users Online
· Guests Online: 110
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Newest Threads
No Threads created
Hottest Threads
No Threads created
Latest Articles
Articles Hierarchy
C Program to Solve any Linear Equation in One Variable
#include <stdio.h>
#include <string.h>
float solve_for_y(float a, float b, float c)
{
float Y = Y = -(b + c) / a;
return Y;
}
main()
{
float a, b, c, Y;
printf("\nEnter a linear equation in one variable of the form aY + b + c = 0 ");
printf("\nEnter the value of a, b, c respectively: ");
scanf("%f%f%f", &a, &b, &c);
Y = solve_for_y(a, b, c);
printf("\nSolution is Y = %f", Y);
}
$ gcc linear_equation.c -o linear_equation
$ ./linear_equation
Enter a linear equation in one variable of the form aY + b + c = 0
Enter the value of a, b, c respectively: 2 4 8
Solution is Y = -6.000000
#include <string.h>
float solve_for_y(float a, float b, float c)
{
float Y = Y = -(b + c) / a;
return Y;
}
main()
{
float a, b, c, Y;
printf("\nEnter a linear equation in one variable of the form aY + b + c = 0 ");
printf("\nEnter the value of a, b, c respectively: ");
scanf("%f%f%f", &a, &b, &c);
Y = solve_for_y(a, b, c);
printf("\nSolution is Y = %f", Y);
}
$ gcc linear_equation.c -o linear_equation
$ ./linear_equation
Enter a linear equation in one variable of the form aY + b + c = 0
Enter the value of a, b, c respectively: 2 4 8
Solution is Y = -6.000000
Comments
No Comments have been Posted.
Post Comment
Please Login to Post a Comment.