[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3416
  • Last Modified:

c# asp.net - convert int to a float for decimal calculations

Hi,
Can someone show me how to convert an int to a float or another variable that will allow me to do calculations with two decimal points?
Thanks
0
CharlieDev
Asked:
CharlieDev
  • 2
3 Solutions
 
JPJ78Commented:
Use the Convert object.
Convert.ToDecimal(12)
Convert.ToDouble(9)

Open in new window

0
 
JPJ78Commented:
That should obviously be something like (I'm mainly a VB programmer)
Decimal d = Convert.ToDecimal(12);
0
 
bedanandCommented:
Here it is





decimal sum = (decimal)fristvalue + (decimal)secondvalue;

Open in new window

0
 
CharlieDevAuthor Commented:
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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