one output is correct other one is showing run time error
Https://ide.codingblocks.com/s/124904
hi @Tusharbhatia15,
You have used int to store number a and b but in the question it is given that the length can go upto 100 which means you are trying to store a number of order 10 raised to the power of 100 in int which is not possible as int can take numbers only upto 10 raised to the power of 7.
i have used double in place of int but i am getting a very long output
How do you think double will solve your problem . Double can store value only till the range of 10 raised to the power of 20(10^20) at max. But here you will get input of order of 10 raised to the power 100(10^100). As a hint use string and change you method to solve it.
Hi @Tusharbhatia15,
In the input function you have taken n as input while you get three inputs only .One for test case and the other for the first number .But there you take lets say 10111 as input so a array of size 10111 is made in your program .Correct that and try again.
unable to understand what you are trying to say
not getting any output
see you will get three inputs in the question . Ex : 2 , 10111,10101 … So the first 2 is number of test case and will go in n defined in main method . Then input() function will be called and second input which is the first number 10111 will be the n in input() function that means a array of 10111 size will be created which is wrong . And after it will be created then the following for loop will require 10111 different inputs . SO your program is waiting for the remaining inputs there. Look for comment in this code .
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.