Converting from integer to double | Sololearn: Learn to code for FREE!
0

Converting from integer to double

please I'll need a code on converting from integer to double in c#, tried but I was told I can't implicitly do that.

9th Jun 2018, 6:02 PM
bhirkoff
bhirkoff - avatar
13 Antworten
0
I'll try that now and get back to yoy
9th Jun 2018, 6:15 PM
bhirkoff
bhirkoff - avatar
0
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int x = 10; int y = 4; System.Convert.Todouble(x/y); } } }
9th Jun 2018, 6:25 PM
bhirkoff
bhirkoff - avatar
0
that didn't work
9th Jun 2018, 6:28 PM
bhirkoff
bhirkoff - avatar
0
u can implicitly convert as well: class x { static void Main(string[] args) { int x = 2; int y = 4; System.Console.WriteLine(((double)x/(double)y)); } } bhirkoff
9th Jun 2018, 10:52 PM
Flash
0
Flash I'll try that now
10th Jun 2018, 8:19 AM
bhirkoff
bhirkoff - avatar
0
Donna still gave me an integer answer
10th Jun 2018, 8:24 AM
bhirkoff
bhirkoff - avatar
0
Flash it gave me an error
10th Jun 2018, 8:25 AM
bhirkoff
bhirkoff - avatar
0
bhirkoff just copy and past my code in a blank .cs file
10th Jun 2018, 8:26 AM
Flash
0
alright
10th Jun 2018, 8:28 AM
bhirkoff
bhirkoff - avatar
0
@perfect thanks
10th Jun 2018, 8:30 AM
bhirkoff
bhirkoff - avatar
0
Flash that was a mistake.. you should know I marked it as the best answer and should have been a mistake.. why did you have to make me feel bad... I'm a professional internet marketer.. just needed to go into programming
10th Jun 2018, 8:49 AM
bhirkoff
bhirkoff - avatar
0
bhirkoff i didÔÇÖt know who it was , donÔÇÖt feel bad.
10th Jun 2018, 10:14 AM
Flash