Problem Description Link
This is easy big integer problem. To solve this problem you can use character array or string
because input size is large this input can not handle by any integer type. You can follow this stapes.
1. get a string input.
2. Reverse that input using user defined function
N.B: if you use built in function strrev() ,you may get compile error for this problem.
3. after after completing reverse add each value with other array that initially assign NULL.
4.this process is running until input is single 0.
5. Finally Reverse the array that contain result and print.
Example:
get input:a=9324
reverse of a =4239
array c=0000
add a with c and c= 4239
clear array a
get input a= 952
reverse of a= 259
add with c= 4239
a= 2590
c= 67201
get input a=0
reverse c=10276 it is final result.
This is easy big integer problem. To solve this problem you can use character array or string
because input size is large this input can not handle by any integer type. You can follow this stapes.
1. get a string input.
2. Reverse that input using user defined function
N.B: if you use built in function strrev() ,you may get compile error for this problem.
3. after after completing reverse add each value with other array that initially assign NULL.
4.this process is running until input is single 0.
5. Finally Reverse the array that contain result and print.
Example:
get input:a=9324
reverse of a =4239
array c=0000
add a with c and c= 4239
clear array a
get input a= 952
reverse of a= 259
add with c= 4239
a= 2590
c= 67201
get input a=0
reverse c=10276 it is final result.
No comments:
Post a Comment
Write your comment - Share Knowledge and Experience