[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to make a prog more efieiant (in C)



Sorry if i mislead some one im just trieng to make my progy work better. (It's an HW assignment)
btw do you mean :res_3
simatric ?
char res_2,res_3;
res_2=(char)num;
res_3=res_2;
then
loop to rearnge the res_2
and (res_2==res_3)?0:1; ?

On 12/1/06, Kevin Ross <kross@statuspro.tv> wrote:
Is this from a recent job interview, with whiteboard programming questions?

Anyway, get_max_digit() and get_sum_digits() seem perfectly reasonable.  For reverse_num() and is_symmetric(), about the only other approach I can think of is converting the numbers to strings first, do your manipulations, then convert back to integers.  It would be fewer lines of code probably, but not necessarily more efficient.

-- Kevin




Reply to: