Solved

Dealing with long integers in pascal

Posted on 2009-07-01
1
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Suggested Solutions

Title # Comments Views Activity
Tstream to hex 1 1,781
audio record to file 4 1,150
TEdit.SetFocus trouble 3 174
How to slide a FMX tabcontrol tabitem up from the bottom 3 1,181
Check out this step-by-step guide for asking an anonymous question on Experts Exchange.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

759 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