Solved

Dealing with long integers in pascal

Posted on 2009-07-01
1
427 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This article outlines the process to identify and resolve account lockout in an Active Directory environment.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

831 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