program to generate N Random Numbers between any two specified numbers
2.accept anumber and print its binary and hexadecimal
3. convert ASCII value to its equivalent character
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 7, 2013, 10:17 PM EDT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
static void Main(string[] args)
{
Console.WriteLine("Enter a number to get its binary and hex equivalent");
// create some examples
int no = Convert.ToInt32(Console.ReadLine());
string binary = Convert.ToString(no, 2);
string myHex = no.ToString("X"); // gives you hex
Console.WriteLine("Binary: {0}",binary);
Console.WriteLine("Hex: {0}", myHex);
Console.ReadKey();
}
}
}
ASCII to char:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
static void Main(string[] args)
{
Console.WriteLine("Enter ASCII value to get the char");
// create some examples
int ASCII = Convert.ToInt32(Console.ReadLine());
// Cast to Char - display an integer as its ASCII value - 69 = E
Console.WriteLine((Char)ASCII);
// or use the convert method
Console.WriteLine(Convert.ToChar(ASCII));
Console.ReadKey();
}
}
}
VulpesRank #55 · 29.2K reputationPosted Sep 8, 2013, 8:31 AM EDT