I do factorial problem and can run with test 10^9(max) in free pascal ver 0.9.2 but when i submit it i have NZEC error. Please help me
created
last reply
- 11
replies
- 1.9k
views
- 4
users
I do factorial problem and can run with test 10^9(max) in free pascal ver 0.9.2 but when i submit it i have NZEC error. Please help me
HI, im new to this and was wondering if someone could help me figure out what´s wrong with my code since every time y submit it i get the NZEC error. Its written in pascal. Thank you very much.
program readfile;
uses
crt,dos;
var
a,b,c:integer;
input,output:text;
begin
clrscr;
assign(input, 'c:\input.txt');
reset(input);
assign(output, 'c:\output.txt');
rewrite(output);
readln(input,a);
readln(input,b);
c:=a+b;
write(output,c);
close(input);
close(output);
end.
Welcome to SPOJ!
Are you trying to solve one of the specific problems or just trying out some Pascal? If the former, then which problem? If the latter, then I suggest using ideone.com, as it's a compiler, the NZEC is given because your code aborted abnormally.
In the case of this code, the file input.txt doesn't exist on the spoj server. All input is read from the standard input, not files.
If you have more questions, feel free to post back. Many here would be glad to answer them.
If you're using windows, then your file should compile into an executable, once you've done that you execute the file like so:
Test.exe test.out
That will redirect the input from test.in, and place the output in test.out
If you're using a uniz environment, then google redirect stdin.
i've never used matlab, but most users here use c/c++ or java. I use some c# as well depending on where I am.