Programming Help: Solving y = 5 (x/10)3 for x - Marta

In summary, Marta's first program prints "Hello my name is Marta, this is the output of my first program." Then, it defines a table that stores x and y values. For each value starting with -4 to 3, it calculates the coresponding y value and prints it. Next, it checks to see if y is equal to 0. If it is, it prints "y is zero." If y is not equal to 0, the program prints y is + or - depending on the value of x. Lastly, it prints the name of the programmer and says the program is halting.
  • #1
Marta
4
0
Can someone help me with this,
I have to write a program that computes values of a formula that expresses y in terms of x
the formula is y = 5 (x/10)3 ; the 3 is to the 10^3 .


also , my program need to find which of the y values is closest to 1 ( either larger or smaller ). then print the x value that gives this closest y value . Print how close the y value is to 1 .


Can someone please help me with this .
Marta
 
Computer science news on Phys.org
  • #2
Which language is this for? What don't you actually understand?
 
  • #3
c language

this is for C language . and I don't know how to write a program for these two tasks. which is whati need help with
 
  • #4
And I assume this is for a class? We don't give help unless you show us some effort.
 
  • #5
please help with this

using C I have to write a program to compute values of formula y=5(x/10)^3
1. I have to give my name
2.use values starting with -4 to 3 increase by 0.5
3.each value should compute the coresspoding y value
4. the message should say
if the value y is exactly 0 , the message shhould say y is zero.
if the value is + , the message should say y is +
if the value is - , the message should say y is -
5. once x=3 , the program should print a message ( underneath the last line of output ) giving my name and saying the program is halting. then stop


this is what I have done so far :

1./*program prog1c.c : print the formula y= [ (x/10) POW 3) *5] */
# include <stdio. h >
int main ( )
{
printf ( " Hello my name is Marta , this is the output of my first program")
table x , y ;
for (x = -4 ; x < = 3 ; x=x+0.5 );
y = [ (x/10) POW 3 ) * 5 ] {
printf ( "%f %f ", x ,y )
if ( = = ...this is where I got stuck. I don't know how to write the if values...can you please help and check my earlier work

MArta
 
  • #6
You got to be kidding me. That code doesn't make any sense. Where did you define table? Do you know that the for loop isn't going to do anything? Square brackets are reserved for arrays, unless you overload the operator. pow is a function and requires (). You also need to include math.h. What are you doing sticking a { at the end of an assignment statement? I suggest you pick up a good c programming book and read it.
 
  • #7
Besides all the syntax and logic errors that dduardo meantioned I would like to add the following:
Programming, like many things, requires a lot of practice and reading. Failure to practice, read the text, and show up for lectures when you're a novice will almost always result in failing the class.


Ryan
 

FAQ: Programming Help: Solving y = 5 (x/10)3 for x - Marta

What is the equation being solved?

The equation being solved is y = 5 (x/10)^3 for x.

What is the purpose of programming help for this equation?

The purpose of programming help for this equation is to find the value of x that satisfies the equation and to understand the steps involved in solving it.

What is the meaning of the variables in this equation?

The variable y represents the output or dependent variable, while x represents the input or independent variable. The number 5 is a constant, and 10 is the coefficient of x.

What are the steps involved in solving this equation?

The first step is to divide both sides of the equation by 5, giving us y/5 = (x/10)^3. Then, we take the cube root of both sides, resulting in (y/5)^(1/3) = x/10. Finally, we multiply both sides by 10 to isolate x and get the final solution of x = 10 * (y/5)^(1/3).

How can this equation be used in real-life applications?

This equation can be used to solve problems related to growth, such as determining the size of a population after a certain number of years or the amount of money earned from an investment with a fixed interest rate. It can also be used in physics and engineering to calculate the volume or surface area of objects with specific dimensions.

Back
Top