TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Piyush chhabra
NA
83
16.7k
c# datatypes..!!
Jun 23 2014 1:18 AM
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...........!!!
Reply
Answers (
1
)
C# is a type safe
Automatic Garbage Collection