Question: Depending on the platform, the largest integer data type in C will allow you to store numbers that are tens of digits long. In this

Depending on the platform, the largest integer data type in C will allow you to store numbers that are tens of digits long. In this question, you will write a program that will enable you to add and subtract non-negative integers that are at most a thousand digits long. To this end, create two strings that can be used to store upto 1000 digit positive integers in base 10; Each digit will be a character in the usual positional number system. Obtain these numbers as input from the user and assume that the first number is greater than or equal to the second & that the numbers are non-negative (no error handling needs to be done for these cases). Your program should compute their sum and difference and store it in a string without padding zeros to the left. Also, you should print the sum and difference. Write the entire program in the main() function without having to write separate functions. Error handling needs to be done for cases where the user does not enter a correct decimal number or if the number entered is larger than a 1000 digits. You are not allowed to use library functions from the string library, except possibly for getting string input from the user.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!