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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started