Hackety Hacking Problem Longsum Implemented Ruby

From OLPC
Revision as of 14:19, 16 October 2007 by Vijjay (talk | contribs) (Solution)
Jump to: navigation, search

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........