fork download
  1. program ideone;
  2. var
  3. index, num : qword;
  4. fact : extended;
  5. begin
  6. repeat
  7. write('Enter a number greater than 0 and lessthan 1754: ');
  8. readln(num);
  9. until (num > 0) and (num < 1754);
  10. fact := 1.0;
  11. for index := 2 to (num+1) do
  12. fact := fact * index;
  13. fact := fact - 1.0;
  14. writeln('The sum of values from 1*1! to ',num,'*',num,'! is ',fact);
  15. end.
Success #stdin #stdout 0s 5304KB
stdin
1753
stdout
Enter a number greater than 0 and lessthan 1754: The sum of values from 1*1! to 1753*1753! is  1.97926189010501005529E+4930