i have some formula.

(find kubik feet) aswer = ((height(inch)/12 * height(inch)/12 * width(feet))/16

i want to solve this formula and asnwer in kiubic feet

i am using double data type and c# language;
ex: height = 48inch ,width =12feet

double height_in_feet = 48/12;
double width_in_feet =12;
double ans=(4*4*12)/16;
Messagebox.Show(ans.toString()); //12.00 kubic feet(its mean 12 feets and 0 inch)
//(maximum inch may be 11 because 12inch = 1feet)
but some time this answer wrong: like height = 44inch ,width =13feet then answer should be 10.11(its mean 10 feet and 11 inchs)

i have some formula.

(find kubik feet) aswer = ((height(inch)/12 * height(inch)/12 * width(feet))/16

i want to solve this formula and asnwer in kiubic feet

i am using double data type and c# language;
ex: height = 48inch ,width =12feet

double height_in_feet = 48/12;
double width_in_feet =12;
double ans=(4*4*12)/16;
Messagebox.Show(ans.toString());

//12.00 kubic feet(its mean 12 feets and 0 inch)
//(maximum inch may be 11 because 12inch = 1feet)
but some time this answer wrong: like height = 44inch ,width =13feet then answer should be 10.11(its mean 10 feet and 11 inchs)

Edited 5 Years Ago by elshan0011: code tag issue

The Formula you are using has not problem I couldn't understand yet what is the problem you are facing?... actually you are interpreting it wrong when you say 12.00 cubic feet then it doesn't mean 12 feet and 0 inches and when you say 10.94 then it also doesn't mean 10 feet and 94 inches these are 12 cubic feet and 10.94 cubic feet if you want to change it in inches you have to use the formula of cubic to inch converter

Edited 5 Years Ago by abelLazm: n/a

i have some formula.

(find kubik feet) aswer = ((height(inch)/12 * height(inch)/12 * width(feet))/16

i want to solve this formula and asnwer in kiubic feet

i am using double data type and c# language;
ex: height = 48inch ,width =12feet

double height_in_feet = 48/12;
double width_in_feet =12;
double ans=(4*4*12)/16;
Messagebox.Show(ans.toString());

//12.00 kubic feet(its mean 12 feets and 0 inch)
//(maximum inch may be 11 because 12inch = 1feet)
but some time this answer wrong: like height = 44inch ,width =13feet then answer should be 10.11(its mean 10 feet and 11 inchs)

http://system32.6te.net/formula.jpg

i include some table,they as real values and actual answer for the solution.help it to test the solution and C# cord compilation

I couldn't understand your problem. But i assume that you are not getting the right answer sometimes. Try modifying line 1 like this...

double height_in_feet= 48.00/12.00

can you post your code ?

Edited 5 Years Ago by Arbus: n/a

Yes arbus i also couldn't understand yet what is he asking... in addition to arbus use .00 with every double value
in my opinion answers should be 44, 12 = 10.10
44, 2 = 1.68
44, 4 = 3.4
44, 13 = 10.94
44, 19 = 15.99

Edited 5 Years Ago by abelLazm: n/a

circ           width             aswer
44             4                 3.4 feet
40             7                 4.10 feet
40             16                11.1 feet
40             23                15.11 feet

this are the example value and they are 100% correct.i want that answer as in my program.but some answers cannot come in my program.

use my program with my example values abouve

Edited 5 Years Ago by elshan0011: n/a

I couldn't understand your problem. But i assume that you are not getting the right answer sometimes. Try modifying line 1 like this...

double height_in_feet= 48.00/12.00

can you post your code ?

private double ChekValue(string width, string hight)
            {
            double widht = Convert.ToDouble(width);
            double height = Convert.ToDouble(hight);
            double actual_width_adi_height = widht / 12;
            double result = (actual_width_adi_height * actual_width_adi_height) / 16;
            double last_result = result * height;
            return last_result;
            }

Did you do what myself and abelazm said, modifying the double values with .00 ?
Like this...

double actual_width_adi_height = widht / 12.00;
double result = (actual_width_adi_height * actual_width_adi_height) / 16.00;

Edited 5 Years Ago by Arbus: n/a

Your code is working fine. Yes arbus have you checked his project in my opinion it is doing what he wants but i dnt know the problem

Edited 5 Years Ago by abelLazm: n/a

no abellazm, i couldn't check it, i don't have c# compiler and i didn't download some also.

Edited 5 Years Ago by Arbus: n/a

ok but elshan0011 Let me clear you one thing you have coded perfectly well i have checked and match it with my results your results are right according to the provided formula

Your code is working fine. Yes arbus have you checked his project in my opinion it is doing what he wants but i dnt know the problem

thanks lot for the help.i have some answer table in a book,but i want to do it in problematically.because all ways book reading and get all ways are time wasting work.ok i am try to do it again.....

no abellazm, i couldn't check it, i don't have c# compiler

ok friend!

You aren't using the variables you are defining, but define ans as 12. And you should post to c# forum.

Edited 5 Years Ago by pyTony: n/a

double height_in_feet = 48/12;

This is integer division. What this means is if there is a remainder, it's lost, and then the value is converted to a double. In this case, there isn't a remainder so you have no issue. But what if you put in 45?

double height_in_feet = 45/12;

This gives a result of 3 feet, not the 3.75 that you want. To fix this, include the decimal point in all your numbers

double height_in_feet = 45.0/12.0;
double height_in_feet = 48/12;

This is integer division. What this means is if there is a remainder, it's lost, and then the value is converted to a double. In this case, there isn't a remainder so you have no issue. But what if you put in 45?

double height_in_feet = 45/12;

This gives a result of 3 feet, not the 3.75 that you want. To fix this, include the decimal point in all your numbers

double height_in_feet = 45.0/12.0;

This is the sample!

1foot = 12 inch
double width =12 //foot

double circu = 44/12 ; //to convert foot
double circu_cal =circu*circu*width/16;
double ans_dbl =circu_cal*12; //to accurate and find they are equal
double div_div =ans_dbl/12;// get the perfect value
double rem_div = ans_dbl%12// get remainder


string div_str = Convert.ToDouble( div_div);
string rem_str = Convert.ToDouble(rem_div);
string [] div_arry =div_str.Split('.');
string [] rem_arry =rem_str.Split('.');
int div_int = Convert.ToInt32(div_arry[0]);
int rem_int = Convert.ToInt32(rem_arry[0]);
string answer = div_int.toString()+"."+rem_int.ToString();
This article has been dead for over six months. Start a new discussion instead.