Question: Given a string of integers, write a program to generate an output string as follows i ) From the input integers, filter the integers that

Given a string of integers, write a program to generate an output string as follows
i) From the input integers, filter the integers that are perfect squares. Ex: 1,4,9,16,25,36,49,64,81,100....
ii) For each perfect square obtained from step 1, find its factorial. If the factorial of the number is trailing by zeros, three digits present before the trailing zeros should be appended to output string. If not trailing by zeros append last three digits to string. If there is a preceding zero, it is ignored.
urag
anura
i. If the number is 2 then 21-2, it does not have any trailing zero zeros and there is only one digit in it, so append 2 to output.
ii. If the number is 5 then 5!120, it has one trailing zero and before the trailing zero there are only two digits present so append 12 to output.
iii. If the number is 9 then 91-362880, it has one trailing zero, before trailing zero there are five digits present, so consider three digits before trailing zero that is 288 and append to output.
n09
iv. If the number is 12 then 121-479001600, it has two trailing zeros, before anu trailing zeros there are seven digits present, so consider three digits before trailing zero that is 016 as 0 is preceded here, 0 is ignored and 16 is appended to output.
iii) If there are no positive perfect squares in the input string print -1

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 Programming Questions!