Question

Description Given the following equations sets to calculate the value of variables x, y and z, a2+b Write a program that takes values for integers a and b as input and displays the values of the unknown variable triple (x, y and z) generated by the formulas above. Hint: The input variables a and b should be integers. In case you need to find a function from the math.h library, visit cplusplus.com Sample run A sample run of the program if the user input a-2 and b-1 is as follows: - Finding unknown triple (x,y and z) Enter values of a and b, separated by space The unknown triple set is: y-4.98Please help me program this in C!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Following is the answer:

#include<stdio.h>

int main(){
  
int a,b;
  
// inputs the values
printf("Enter values of a and b, seperated by space>\n");
  
scanf("%d",&a);
scanf("%d",&b);
  
//formula for find values of x,y,z
float x = (a*a) - (b*b);
float y = 2 * a * b;
float z = (a*a) + (b*b);
  
//prints the values of x,y,z
printf("The unknown triple set is:");
printf("\nx = %0.2f",x);
printf("\ny = %0.2f",y);
printf("\nz = %0.2f\n",z);
  
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Please help me program this in C! Description Given the following equations sets to calculate the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++ ab 8 DESCRIPTION: Complete all four problems. 1. Write a program that will accept...

    In C++ ab 8 DESCRIPTION: Complete all four problems. 1. Write a program that will accept two numbers from the user. The program should then evaluate the following equation, using the data input: 2-3X2 - 4Y?. Assume the second number input is Y. Now the program should test Z to see if Z is a negative number or a positive number (assume zero is included as a positive number). The program should output the values of X, Y, and Z...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • guys can you please help me to to write a pseudo code for this program and...

    guys can you please help me to to write a pseudo code for this program and write the code of the program in visual studio in.cpp. compile the program and run and take screenshot of the output and upload it. please help is really appreciated. UTF-8"CPP Instruction SU2019 LA X 119SU-COSC-1436- C Get Homework Help With Che X Facebook -1.amazonaws.com/blackboard.learn.xythos.prod/584b1d8497c84/98796290? response-content-dis 100% School of Engineering and Technology COSC1436-LAB1 Note: in the instruction of the lab change "yourLastName" to your last...

  • please code in basic c++ program Write a program that uses the following formula: n (ax...

    please code in basic c++ program Write a program that uses the following formula: n (ax - ib) i=1 Your program will prompt the user for the number of iterations for the calculation. input values for n, x, a, b, and c. n must be a positive integer, but x, a, b, and c can be any real numbers. Then it will perform the calculation and output the result. Then, it will ask the user if they would like to...

  • NEED HELP WITH THIS . Write a MARIE assembly language program that would simulate calling and exe...

    NEED HELP WITH THIS . Write a MARIE assembly language program that would simulate calling and executing the following C function, as shown below: z = someFunction(a, b); where z, a and b are main( ) program variables, and the values stored in a and b are input by the user. The value stored in z will be output. Did your program execute correctly? This is the code for the function: int someFunction(int x, int y) { return 3 *...

  • Write MARIE assembly language programs that do the following: I. Write a program that inputs thre...

    Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...

  • I need this in JAVA please: Design and implement a program (name it MinMaxAvg) that defines...

    I need this in JAVA please: Design and implement a program (name it MinMaxAvg) that defines three methods as follows: Method max (int x, int y, int z) returns the maximum value of three integer values. Method min (int X, int y, int z) returns the minimum value of three integer values. Method average (int x, int y, int z) returns the average of three integer values. In the main method, test all three methods with different input value read...

  • Been working on this program for hours and keep getting error. PLEASE help and show a...

    Been working on this program for hours and keep getting error. PLEASE help and show a working output, Thank you Step 2: Declaring variables Examining the problem we need to have 2 variable to store integer input given by the user.     int x,y; Step 3: setting up Scanner object and scanning the inputs import java.util.Scanner; Create Scanner class object by using following syntax Scanner=new Scanner(System.in); /* give some name to the object which ever you want */ Ask the...

  • Please help with this function i'm having trouble with: must be written in c++ All of...

    Please help with this function i'm having trouble with: must be written in c++ All of the functions you must write take at least two parameters: an array of strings, and the number of items the function will consider in the array, starting from the beginning. Your implementations must not use any global variables whose values may be changed during execution. Your program must build successfully under both Visual C++ and either clang++ or g++. Your program must not use...

  • Topics If/Else statement Description    Write a program that determines the larger of the two numbers...

    Topics If/Else statement Description    Write a program that determines the larger of the two numbers provided by the user. The program asks the user to enter a number. Then it asks the user to enter another but a different number. Then, it determines the larger of the two numbers and displays it to the user. (If the user happens to enter the two numbers the same, the program may report either of the two numbers as larger.) Requirements Do...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT