Hackety Hacking Problem Longsum Implemented Ruby: Difference between revisions

From OLPC
Jump to navigation Jump to search
Line 23: Line 23:


== Solution ==
== Solution ==

Will be uploaded quickly........

Revision as of 18:19, 16 October 2007

Problem Statement

Hi do you know one of the limitations of your compiler.Let me introduce you with it.This is that "size of the integers or number with it can work with is limited".So many a times it happens that you cannot do a sum on your compiler because it exceeds the size of integer supported by the compiler.So lets do something so that you can do the calculations without caring about the size of the integer and not even losing precision. Write a program that takes two no and gives output as its sum.

HINT: Use strings to achieve the task.

Sample Output

Enter the first no: 5555555555555555555555555
Enter the second no.4444444444444444444444444
The sum of the two numbers is : 9999999999999999999999999

Curriculum Connections

This problem gives student help in understanding few thins mentioned below:

  • How to convert data from one type to another(TYPECASTING)
  • Why typecasting is useful
  • The benefit of using STRINGS
  • Knowing about the limitations of the compiler

Solution

Will be uploaded quickly........