Skip to content

To compute basic mathematical calculation like addition, subtraction, etc. on large digit number using c++

Notifications You must be signed in to change notification settings

Mehul2205/BigInt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BigInt

To compute basic mathematical calculation like addition, subtraction, multiplication and division on a large digit number in c++.

int i = 0; char ch = i; cout<<ch;

Output : 48

So, whenever we add 48 into a number this is to convert an integer into a string and vice versa.

Code for Padding the bits :

  1. string ZeroPadNumber(string ret, int num){
  2. int str_length = ret.length();
  3. for (int i = 0; i < num - str_length; i++)
  4.  ret = "0" + ret;
    
  5. return ret;
  6. }

Addition

Key points

  1. In c++ you cannot store 10-20 digit number, so if we want to add these numbers then this concept is used.
  2. Time Complexity - O(n) where n indicate length of number i.e., number of digits.
  3. No Exception, run for all cases.

Screenshot

image1

Subtraction

Key points

  1. In c++ you cannot store 10-20 digit number, so if we want to implement subtraction on these numbers then this concept is used.
  2. Time Complexity - O(n) where n indicate length of number i.e., number of digits.
  3. No Exception, run for all cases.

Screenshot

image2

Multiplication

Key points

  1. In c++ you cannot store 10-20 digit number, so if we want to add these numbers then this concept is used.
  2. Time Complexity - O(n*n) where n indicate length of number i.e., number of digits.
  3. No Exception, run for all cases.

Screenshot

image3

Division

Key points

  1. In c++ you cannot store 10-20 digit number, so if we want to add these numbers then this concept is used.
  2. Time Complexity - O(2^n) where n indicate length of number i.e., number of digits.
  3. 1 Exception, this code is recursive in nature, if stack is overloaded then it will terminate abruptly.

Screenshot

image4

About

To compute basic mathematical calculation like addition, subtraction, etc. on large digit number using c++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages