# Programming Help?

1. Feb 6, 2005

### Marta

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 .

Marta

2. Feb 6, 2005

### dduardo

Staff Emeritus
Which language is this for? What don't you actually understand?

3. Feb 6, 2005

### Marta

c language

this is for C language . and I dont know how to write a program for these two tasks. which is whati need help with

4. Feb 6, 2005

### dduardo

Staff Emeritus
And I assume this is for a class? We don't give help unless you show us some effort.

5. Feb 8, 2005

### Marta

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 dont know how to write the if values...........can you please help and check my earlier work

MArta

6. Feb 8, 2005

### dduardo

Staff Emeritus
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. Feb 9, 2005

### LogiX

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