View Single Post
Old 22-02-2005, 09:22 AM   #3
aaberg
Game Wizzard

 
Join Date: Aug 2004
Location: Aasane, Norway
Posts: 238
Default

Answers in C#

1.

[STAThread]
static void Main(string[] args)
{
Console.WriteLine(Console.ReadLine());
}



2.
[STAThread]
static void Main(string[] args)
{
int a;
int b;
int result;

a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());

result = a + b;
Console.WriteLine(result.ToString());

result = a * b;
Console.WriteLine(result.ToString());

result = a / b;
Console.WriteLine(result.ToString());

result = a - b;
Console.WriteLine(result.ToString());
}


3.
[STAThread]
static void Main(string[] args)
{
int a;
int b;
int dummy;

a = Convert.ToInt32(Console.ReadLine());
b = Convert,ToInt32(Console.ReadLine());

dummy = a;
a = b;
b = dummy;

Console.WriteLine(a.ToString());
Console.WriteLine(b.ToString());
}


4.
[STAThread]
static void Main(string[] args)
{
int a;
int b;
int result;

a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());

result = a*b;
Console.WriteLine(result.ToString());

result = a + a + b + b;
Console.WriteLine(result.ToString());
}


Easy.
aaberg is offline                         Send a private message to aaberg
Reply With Quote