human
Minimum number with digits as 4 and 7 only and given sum | Prints minimum number with given digit sum and only allowed digits as 4 and 7..
Cases where all remaining digits are 4 or 7 ( Remaining sum of digits should be multiple of 4 or 7 ).
If both 4 s and 7 s are there in digit sum , we subtract a 4..
Driver code"
Solution in Python:
 ... Give me a code to minimum number with digits as 4 and 7 only and given sum and the other steps required?
assistant
#Here is code to minimum number with digits as 4 and 7 only and given sum and the other steps required.
 def findMin ( s ) :
	a , b = 0 , 0
	while ( s > 0 ) :
		if ( s % 7 == 0 ) :
			b += 1
			s -= 7
		elif ( s % 4 == 0 ) :
			a += 1
			s -= 4
		else :
			a += 1
			s -= 4
	string = " "
	if ( s < 0 ) :
		string = " - 1"
		return string
	string += "4" * a
	string += "7" * b
	return string
print findMin ( 15 )