|
|
back to boardwhy compilation error ? I wrote in C# Posted by Jojas 7 Apr 2008 14:41 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Factorize { class Program { static int capture(string a) { return( a.Length - 3); } static int calculate(string a) { int i,n = 0,sum=1,x=0,y=0,count=0; if (a[1] != '0') a = '0' + a; n = capture(a);
if (a[0] == '1') x = 10; else x = a[1] - '0'; count = x; sum = x; for (i = 0; i > -1; i++) { if ((count-n) <= 1) break; else { sum= sum * (x - n); count = count- n; x = count; } } return sum; } static void Main(string[] args) { string a; int sum = 0; a = Console.ReadLine(); sum = calculate(a); Console.WriteLine(sum);
} } } I copy source code then it told me compilation error? Edited by author 07.04.2008 14:47 Re: why compilation error ? I wrote in C# i think it should contain Main method ..... and just your class + usings are needed not your all whole nameSpace and i think you find that out by now . Edited by author 02.05.2012 22:13 |
|
|