hello every one..
i am trying to make a console programe in c# in which i want to calculate the product of divisors of a number.
for example the number is 12 then its divisors are 2, 3, 4 ,6. then output should be 2*3*4*6=144.
Here is my code..
using System;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Clear();
ulong b=0; ulong c = 1;
b = Convert.ToUInt32(Console.ReadLine());
for (ulong i = 2; i <=b/2; i++)
{
if (b % i == 0)
{
c = c * i;
}
}
Console.WriteLine(c);
}
}
}
Now my problem is that i want to run this programe for large numeric numbrs like 10000 or 100000 or 2-3 lakhs may be.
but it gives correct output only for small numbers. it does not give correct output for large number like 10000 whose product of divisors will be very large.
i tried to use high data types but its not giving correct output.
what is going wrong...
Please programersss Help me...........!!!