Solved

Dealing with long integers in pascal

Posted on 2009-07-01
1
423 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
Comment Utility
Never mind I figured out the solution. I could use int64 :)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now