Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Phil Carmody <pc+usenet@asdf.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study |
| Date | 2015-01-03 15:08 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <8761co2erw.fsf@bazspaz.fatphil.org> (permalink) |
| References | (1 earlier) <n0h0aadudc4ikp2cdp4umi3f7bea53315j@4ax.com> <87d273czw7.fsf@bsb.me.uk> <d754b314-f1e5-4b34-913c-5e4626bca1b9@googlegroups.com> <87ppb3biyh.fsf@bsb.me.uk> <gV_nw.239857$Cy6.150958@fx23.am4> |
BartC <bc@freeuk.com> writes:
> On 28/12/2014 20:47, Ben Bacarisse wrote:
> > bert <bert.hutchings@btinternet.com> writes:
> >
> >> On Sunday, 28 December 2014 19:56:02 UTC, Ben Bacarisse wrote:
> >>> ... Take a look at the highest common factor program.
> >>
> >> Your age is showing, Ben, and so would mine. Currently,
> >> the preferred terminology is greatest common divisor.
> >
> > It's also my preferred term (does that make me young again?!), but I
> > thought I'd stick with the term used by the site in question so people
> > could find it (though, really, don't bother).
>
> Too late. But I couldn't find it using either 'highest' or 'greatest'
> on the page of C questions. (I had to use the search box.)
If you were aware that it might be called either HCF or GCD,
then why didn't you search for "common" instead - it's the
second instance on the page.
Then again, it's the first and only instance on the page of
"highest", so perhaps you should investigate getting a browser
with less brokenness.
> What was the problem with the code anyway, the algorithm? It worked,
> sort of (it's slow for big numbers, and returns garbage when there is
> no gcd >= 2 or both operands are negative).
Isn't being 3 times longer than code that actually works, and scales
well for large numbers (being linear rather than exponential in the
size of the input) reason enough to barf at the sight of it? I was
half way between barf and laugh, certainly. (Thanks, Ben, for the
laugh half!)
> It does however use scanf("%d %d",&a,&b) which I had more of an issue
> with: it seems the separator has to be white-space only, you can't use
> a comma. Another mark against scanf.
Code showing you how to take the GCD of two numbers has no
reason to show you how to input two numbers anyway, that's
an answer to a different question.
Phil
--
The best part of re-inventing the wheel is that you get to pick how
many sides the new one has. -- egcagrac0 on SoylentNews
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study EQuestionAnswers Inc <equestionanswers@gmail.com> - 2014-12-27 22:41 -0800
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Barry Schwarz <schwarzb@dqel.com> - 2014-12-28 10:02 -0800
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-12-28 19:55 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study bert <bert.hutchings@btinternet.com> - 2014-12-28 12:41 -0800
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-12-28 20:47 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study BartC <bc@freeuk.com> - 2014-12-28 21:48 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-12-29 00:57 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Phil Carmody <pc+usenet@asdf.org> - 2015-01-03 15:08 +0200
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study BartC <bc@freeuk.com> - 2015-01-03 13:31 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-01-03 15:13 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study BartC <bc@freeuk.com> - 2015-01-03 21:23 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Dr Nick <nospam-4@temporary-address.org.uk> - 2014-12-29 09:45 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Ike Naar <ike@iceland.freeshell.org> - 2014-12-29 09:57 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study bert <bert.hutchings@btinternet.com> - 2014-12-29 04:07 -0800
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Phil Carmody <pc+usenet@asdf.org> - 2015-01-03 15:43 +0200
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-01-03 13:57 +0000
Re: www.equestionanswers.com - C,C++, VC++,MFC,COM,DCOM, DLL question and answers for interviews and self-study Greg Martin <greg.at.softsprocket@dot.com> - 2015-01-03 19:46 +0000
csiph-web