[Tutorial 7] 11.Find the value of y using y = 3.5x+5 at x = 5.23.
#include <stdio.h>
int main() {
float x, y;
/* Given value of x*/
x = 5.23;
int main() {
float x, y;
/* Given value of x*/
x = 5.23;
/*Calculate y using the equation y = 3.5x + 5*/
y = 3.5 * x + 5;
y = 3.5 * x + 5;
/*Display the result*/
printf("When x = %.2f, the value of y is %.2f\n", x, y);
printf("When x = %.2f, the value of y is %.2f\n", x, y);
This C program computes the value of ( y ) using the equation ( y = 3.5x + 5 ), with ( x ) assigned the value of 5.23. It then utilizes this value of ( x ) to calculate ( y ) and outputs the result. This simple yet effective code demonstrates the straightforward implementation of mathematical expressions in C, enabling users to swiftly determine ( y ) given ( x ) in the specified equation.
Comments
Post a Comment