1. ## Need Help Fast!!!!

This is my program so far:

/* This Program has been created to figure out how much it cost to build a Fish Tank. This will be done by inputing the Width, Length, and Height in which the computer in return will calculate the price */

#include <stdio.h>

int main(void)
{
int interger; int L,W,H;
printf("What is the length of your goldfish tank in inches?\n");
scanf( "%d", &L );
printf("What is the width of your goldfish tank in inches?\n");
scanf( "%d", &W );
printf("What is the height of your goldfish tank in inches?\n");
scanf( "%d", &H );
printf("Your goldfish tank costs ????? to
build.\n");
return 0;
}

How do i get this formula (2*(H*W)+2*(L*H)+(L*W))*(.02)) inserted in the right format where those question marks are? So when the program runs the price will come up in \$XX.XX format??

2. Simple,

Just create a floating-type variable:

Code:
`float cost = (2.0f*(H*W)+2.0f*(L*H)+(L*W))*(.02f);`
Then print it:

Code:
`printf("Your goldfish tank costs \$%1.2f to build.\n", cost);`

Hope this helps,
- Stack Overflow

3. Where do i put the floating-type variable? (sorry im a freshman in college and im very new to Programming)

4. No problem.

Here is an overview of the whole code:

Code:
```int main(void) {
int L,W,H;
float cost;

printf("What is the length of your goldfish tank in inches?\n");
scanf( "%d", &L );
printf("What is the width of your goldfish tank in inches?\n");
scanf( "%d", &W );
printf("What is the height of your goldfish tank in inches?\n");
scanf( "%d", &H );

cost = (2.0f*(H*W)+2.0f*(L*H)+(L*W))*(.02f);

printf("Your goldfish tank costs \$%1.2f to build.\n", cost);

return 0;
}```
For future reference, here is some information about printf().

Hope this makes sense,
- Stack Overflow

5. Thanks alot man it worked you are a life saver!!!!!

6. Glad to be of help