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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Sep 8, 2013, 12:31 PM
Sanjeeb LenkaPosted Sep 8, 2013, 2:17 AM
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();
}
}
}