function soln=first_dig_input(x)
%first_dig_input gets the first digit of the real number x. 
% Accepted data is type double. Strings don't work.

%%%% This code was adapted from a snippet found on the Math Works Website.
%%%%%%%% Author "Zane" , http://blinkdagger.com/
%%%% It is assumed that it was devised to be open source / free. If you are
%%%% the author of this code and debate this assumption, please contact me
%%%% immediately.

y=abs(x);
if y < 1
    while y < 1
        y=10*y;
    end
elseif y > 10
    while y > 10
        y=y./10;
    end
else
end
soln=floor(y);

end

