निर्दिष्ट दशमलव के मान को समतुल्य 32-बिट अहस्ताक्षरित पूर्णांक में बदलने के लिए, कोड इस प्रकार है -
उदाहरण
using System;
public class Demo {
public static void Main() {
Decimal val = 0.001m;
Console.WriteLine("Decimal value = "+val);
uint res = Decimal.ToUInt32(val);
Console.WriteLine("32-bit unsigned integer = "+res);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
Decimal value = 0.001 32-bit unsigned integer = 0
उदाहरण
आइए एक और उदाहरण देखें -
using System;
public class Demo {
public static void Main() {
Decimal val = 67.487m;
Console.WriteLine("Decimal value = "+val);
uint res = Decimal.ToUInt32(val);
Console.WriteLine("32-bit unsigned integer = "+res);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
Decimal value = 67.487 32-bit unsigned integer = 67