Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dealing with long integers in pascal

Posted on 2009-07-01
1
Medium Priority
?
446 Views
Last Modified: 2012-05-07
Is there a way in pascal to have a variable that is  atleast 13 digits long? I have a code but can't not get the right results because of the length. I manage to get the right answer in python though. My code is listed below
program factorial;
 
uses sysutils;
 
function factorial(num : Integer) : Cardinal;
begin
	if num <= 1 then
		factorial := 1
	else
		factorial := num * factorial(num - 1);
end;
var
	total : Cardinal;
	index : Integer;
begin
	total := 0;
	index := 0;
		for index := 1 to 15 do
		begin
			writeln(index);
			total := total + factorial(index);
		end;
	Writeln(total);
end.

Open in new window

0
Comment
Question by:codecaine
1 Comment
 
LVL 1

Accepted Solution

by:
codecaine earned 0 total points
ID: 24759323
Never mind I figured out the solution. I could use int64 :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question