this is our activity in school... i dont know anything about this
i already try but it always have an error...
can any one make it... here is the problem
use C++ programming..Write a complete C program that will display the highest common factor of two numbers.
The highest common factor (HCF) of two positive integers a and b is the largest integer that
divides each of a and b exactly. For example, the HCF of 45 and 30 is 15.
Here is a form of Euclid's algorithm for finding the HCF of two integers. Let's say we want
to find the HCF of 36 and 90.
· Write down the numbers: 36 90
· ... and also write down their difference: 36 90 54
· Form a "number chain" by repeatedly writing down the difference between the last
two numbers, stopping when you get to zero. The last non-zero number is the HCF:
· 36 90 54 36 18 18 0
· The HCF of 36 and 90 is 18. (tip: use absolute value)
Example:
Input: 30 45
Output: 15
Last edited by TkTech; 09-21-2009 at 02:40 PM.
This looks like homework. What do you have so far?
Can we make it? Yes.
Will we make it? No.
The program you're asking for is trivial. You'll need to be familiar with loops, storing data in variables, and using expressions. I'm not sure if you're supposed to program this with C or C++, since in your first post it states "Write a complete C program that..." followed by your second post, stating "use C++ programming..".
If you've already tried, post what you've done so far. We can help you from there, explain what the problem is, and in that manner you'll learn more about how to solve problems and how to apply that problem-solving to your programs. The point is to teach you how to program, which yes, involves you seeing a lot of other people's code, but more importantly involves you writing code. Get it?
Wow I changed my sig!
Sure, how much money are you willing to send me to make this?
Thought it was called greatest common factor... anyways, I have this program already made, but you can't see it until you post what you have so far and let us try to help you. Asking for code isn't going to get you any better at programming.
macoder is right man u hav to show what uve done cause i also have the code
And again...
Code:While( !User.hasAnswer ) { User.askQuestion(); if( User.postCode && User.putForthEffort ) { CodeCallMembers.Help(); User.hasAnswer = true; } else { CodeCallMembers.Laugh(); } }
-CDG10620
Software Developer
Successive substraction algorythm works too.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks