Getting error in c# for DCP-35: Square Number

Dev Skill archived problems can be discussed here.

Getting error in c# for DCP-35: Square Number

by tanmoycsit » Thu Jan 05, 2017 12:07 pm

Hi everyone.

I am using C# for solve this problem. When i am debugging into my Visual Studio 2010 then it runs smoothly. But after submission this problem into your system i am getting bellow error. Can anyone please tell me where is the problem?

Error is :

Code: Select all
Unhandled Exception:
System.FormatException: Invalid format.
  at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in


My Source Code Is :
Code: Select all
           
            string TestCases = "";
            TestCases = Console.ReadLine();
            int tCases = int.Parse(TestCases);
            for (int i = 0; i < tCases; i++)
            {
                double val = double.Parse(Console.ReadLine());
                double reminder = Math.Sqrt(val) % 1;
                if (reminder.Equals(0))
                {
                    Console.WriteLine("Case " + (i + 1) + ": YES");
                }
                else
                {
                    Console.WriteLine("Case " + (i + 1) + ": NO");
                }
            }


Thanks,
 
Posts: 2
Joined: Tue Jan 03, 2017 5:54 pm

Who is online
Users browsing this forum: No registered users and 1 guest
cron