long integer multiplication

H

helPlease

hello !! Can anybody provide me an algorithm or C code for long
integer multiplication.It's urgent.
 
J

Joe Estock

helPlease said:
hello !! Can anybody provide me an algorithm or C code for long
integer multiplication.It's urgent.

Please do your own homework or at least attempt to do your own homework
and if you get stuck then post your code. Attempting to solve the
problem yourself and asking for help when you are stuck at least shows
that you are dedicated to learning and not just looking for a free
handout. Since you have declared that this is urgent I suggest you start
writing code immediately.
 
W

Wade Ward

Joe Estock said:
Please do your own homework or at least attempt to do your own homework
and if you get stuck then post your code. Attempting to solve the problem
yourself and asking for help when you are stuck at least shows that you
are dedicated to learning and not just looking for a free handout. Since
you have declared that this is urgent I suggest you start writing code
immediately.
long long x;
int y = 0;
y = y *(int)x;
I think that might be legal.
 
R

Richard Heathfield

helPlease said:
hello !! Can anybody provide me an algorithm or C code for long
integer multiplication.It's urgent.

long int f(long int i, long int j)
{
return i * j; /* but beware of overflow */
}
 
R

Richard Heathfield

Wade Ward said:

long long x;
int y = 0;
y = y *(int)x;
I think that might be legal.

It isn't. The value of x is indeterminate, so the result of the explicit
conversion is undefined.
 
K

Keith Thompson

Joe Estock said:
Please do your own homework or at least attempt to do your own
homework and if you get stuck then post your code. Attempting to solve
the problem yourself and asking for help when you are stuck at least
shows that you are dedicated to learning and not just looking for a
free handout. Since you have declared that this is urgent I suggest
you start writing code immediately.

Perhaps he should start thinking about algorithms immediately;
depending on how much thought he's already given to the problem, it
may not yet be time to start coding.

I will give a hint: if by "long integer" he means the C type "long
int", then he'll find the "*" operator to be quite helpful. If he
means something else, he should say so rather than wasting what little
time he has posing poorly phrased questions.
 
M

Martin Ambuhl

helPlease said:
hello !! Can anybody provide me an algorithm or C code for long
integer multiplication.It's urgent.

inline long int long_multiply(long int x, long int y) { return x*y;}
 
J

Joe Estock

Keith said:
Perhaps he should start thinking about algorithms immediately;
depending on how much thought he's already given to the problem, it
may not yet be time to start coding.

I will give a hint: if by "long integer" he means the C type "long
int", then he'll find the "*" operator to be quite helpful. If he
means something else, he should say so rather than wasting what little
time he has posing poorly phrased questions.
I agree, however do to his wording and the phrase "it's urgent" I
concluded that he was/is looking for a quick grade. If he was not
attempting to have someone else solve his homework question for him then
he should have been more descriptive regarding what he was looking for,
perhaps by stating what it is he hoped to accomplish. I'm by no means an
expert at the C language, or any other language for that matter, but
I've been in the game for several years now and each time I see someone
trying to take the easy way out for a good grade It disgusts me because
those are the ones that the truly knowledgeable developers will have to
come in and clean up after. I don't mind working with code even if it's
originally from someone else, but I do strongly dislike fixing code from
a fresh college graduate that only graduated because he copied the code
from someone else or had someone write it for him purely so that he
could graduate and have a degree in CS.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top