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

This is the code that I have so far. When compiled and ran, it only produces x=0

ID: 3549489 • Letter: T

Question

This is the code that I have so far. When compiled and ran, it only produces x=0.0000000 and y=0.0000000 regardless of input.



#include <stdio.h>

#include <stdlib.h>

#include <math.h>


int main(int argc, char **argv) {


  double a;

  double b;

  double c;

  double d;

  double e;

  double f;

  double x;

  double y;


  printf("ax + by = c ");

  printf("dx + ey = f ");

  printf("Please input the value of a: ");

  scanf("%lf", &a);

  printf("Please input the value of b: ");

  scanf("%lf", &b);

  printf("Please input the value of c: ");

  scanf("%lf", &c);

  printf("Please input the value of d: ");

  scanf("%lf", &d);

  printf("Please input the value of e: ");

  scanf("%lf", &e);

  printf("Please input the value of f: ");

  scanf("%lf", &f);


  y = f/(((d*c-d*b)/a) + e);

  x = (c-b*(f/(((d*c-d*b)/a)+e)))/a;


  printf("x = %f ", &x);

  printf("y = %f ", &y);


  return 0;


}

Explanation / Answer

#include <stdio.h>

#include <stdlib.h>

#include <math.h>


int main(int argc, char **argv) {


double a;

double b;

double c;

double d;

double e;

double f;

double x;

double y;


printf("ax + by = c ");

printf("dx + ey = f ");

printf("Please input the value of a: ");

scanf("%lf", &a);

printf("Please input the value of b: ");

scanf("%lf", &b);

printf("Please input the value of c: ");

scanf("%lf", &c);

printf("Please input the value of d: ");

scanf("%lf", &d);

printf("Please input the value of e: ");

scanf("%lf", &e);

printf("Please input the value of f: ");

scanf("%lf", &f);


y = f/(((d*c-d*b)/a) + e);

x = (c-b*(f/(((d*c-d*b)/a)+e)))/a;


printf("x = %f ", x);

printf("y = %f ", y);


return 0;


}


Check now!! There should not be & when you are printing the values.

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