Multiply two number without using multiplication operator(*)

Omniitstudent
Posted by Omniitstudent under C# category on | Points: 40 | Views : 5427
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication26
{
class Program
{
static void Main(string[] args)
{
int tot = 0;
int nNum1 = Convert.ToInt32(Console.ReadLine());
int nNum2 = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i <nNum2; i++)
{
tot += nNum1;

}
Console.WriteLine("Result is ==>"+tot);

Console.ReadLine();
}
}
}
crazy code.......

Comments or Responses

Posted by: T.Saravanan on: 2/20/2012 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi,

Could you explain, what is the uses of this code?
Posted by: Omniitstudent on: 2/20/2012 Level:Starter | Status: [Member] | Points: 10

This code is generally asked in interview.that's why i published this code............

Login to post response