ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1014. Product of Digits

need clarifications on the posted solution
Posted by Karthik Duraisamy 1 Feb 2011 15:23
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double i, j,a;
            double display=0;
            Console.WriteLine("enter the number:");
            double n = double.Parse(Console.ReadLine());

            try
            {

                for (i = 1; i <= n; i++)
                {
                    for (j = 1; j <= n; j++)
                    {
                        if ((i * j) == n)
                        {
                            a = double.Parse(string.Concat((object)i, (object)j));

                            if (i == 1)
                            {
                                if (n == 1)
                                    display = 1;
                                else
                                    display = a;
                            }
                            else
                            {
                                if (a < display)
                                {
                                    display = a;
                                }
                            }
                        }
                    }
                }

                Console.WriteLine(display);
            }
            catch (NotFiniteNumberException)
            {
                Console.WriteLine(-1);
            }
        }
    }
}

Edited by author 01.02.2011 15:27