Question: = CONBIN: = proc ( n ) # define the procedure local binary; if type ( n , 'posint' ) then binary : = convert
CONBIN:proc# define the procedure
local binary;
if type 'posint' then binary : convert binary; # It first checks if the input is a positive integer.
return cat The integer converts into its binary equivalent', binary;
#If it is it converts the integer to binary using the convert function and concatenates the result into a sentence.
else return 'Input must be a positive integer'; end if; #If the input is not a positive integer, it returns an error message.
end proc;
CONBIN : proc
local binary;
if type 'posint' then
binary : convert binary; return cat The integer', 'converts into its binary equivalent', binary
else
return 'Input must be positive integer'
end if
end proc
CONBIN; #if the input is a positive integer, say the procedure will convert it to binary equivalent of
Theintegerl Oconverts its binary equivalent
CONBIN# if the input is a negative integer, say then there will be an error message.
Input must be a positive integer
#CAN YOU HELP? I want the output of COBIN BE
The integer converts into its binary equivalent of instead of
The integer converts into its binary equivalent ie remove the stars and add space
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
