vineeths96 / Large-Unsigned-Integer-Arithmetic

In this repository, we deal with the task of arithmetic operations (addition and multiplication) on large integers represented by singly-linked lists and doubly-linked lists.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Language Contributors Forks Stargazers Issues MIT License LinkedIn


Large Unsigned Interger Arithmetic

Addition and Multiplication of Large unsigned integers
Explore the repository»

View Problem Statement

tags : large ints, unsigned ints, linked list, singly linked lists

About The Project

This program performs the arithmetic operations (addition and multiplication) on large integers represented by singly linked lists. The entire program is written in three files - client.c, header.c, and implement.c. Comments have been added frequently to help in understanding the logic behind implementation. The maximum number of operands and the size of the input string expression has been limited to 5 and 100 respectively. They can be modified by varying OPMAX and SMAX values in header.c file, if required. This program repeats indefinitely till exited manually. Refer Problem statement file for detailed information.

The function when executed expects the user to input a string of expression containing large integers and arithmetic operators. The large integers should be comma separated with a base of 10000 and should be terminated with a '$' sign. The arithmetic operators allowed are addition(+) and multiplication(*). The operands and operators are separated and inserted into corresponding linked lists with str_split(), get_number() and get_operator() functions. The operands and stored in an array of linked lists. The evaluate() function is called when an '=' is encountered and it performs the operations by reading one operator and two operands from the linked lists. The addition is performed by addition() and multiplication by multiplication() functions. The final result after execution is printed on screen and then the lists are deleted to free up used space.

Built With

This project was built with

  • C
  • Ubuntu 18.04.1
  • gcc version 7.4.0

Getting Started

Clone the repository into a local machine using

git clone https://github.com/vineeths96/Large-unsigned-interger-arithmetic

Instructions to run

Open the terminal, make the program and run it.

make
./a.out

Enter the values from the file (or custom values) as requested during execution of the program.

Testcases

The testcase.txt contains the 5 test cases. Comments have been added to guide through the test case file to identify where to input data.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Vineeth S - vs96codes@gmail.com

Project Link: https://github.com/vineeths96/Large-unsigned-interger-arithmetic

About

In this repository, we deal with the task of arithmetic operations (addition and multiplication) on large integers represented by singly-linked lists and doubly-linked lists.

License:MIT License


Languages

Language:C 98.1%Language:Makefile 1.9%