• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

silli question about double AND strings

I have a simple function in C# that takes a number and power it by 2 like this
nr=Math.Pow(nr,2);

ok this might seem like a silly question, but what I want to do is return this number but in normal format, what I get now is something like 1,23459E+23
but what i realy want it 123456897,33

How can I do this
0
rustebbi
Asked:
rustebbi
1 Solution
 
tpattenCommented:
How is that number declared? Go with decimal and you should get what you are looking for.
0
 
testnCommented:
It depends on how you print it...

you might use
Console.WriteLine("{0:D}",nr);

or convert nr to string by

string nrvalue = nr.toString("D");
0
 
ChuckPCommented:
Alternatively you could explicitly convert it:

Convert.ToDouble(Mth.Power(nr,2));
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now