Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dealing with long integers in pascal

Posted on 2009-07-01
1
Medium Priority
?
439 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

Read on to get a few ideas on how to promote your next corporate event.
Check out what's been happening in the Experts Exchange community.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

715 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