Thread: A Help!

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    2

    Exclamation A Help!

    I've got this assignment to be completed. Kindly help:
    A kid was asked to simplify 26/65. He simply cancelled tenchnique produced result 26/65 = 2/5 (Cancellation of 6)
    Write a program to determine all fractions with two digit numertors and denominators for which the kid's technique work correctly.

    Having a tough time to solve this example.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Well, thing is, we're not here to do your math homework for you.... Work the problem and when you have some code, you can post about any problems you may be having. Show us your code, ask specific questions and we'll see what we can do...

    Homework Policy

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    2
    Okay. I know. Wait. I am beginner in learning C programming. I'll be glad if you elaborate your answer. Take pain to write some initials or hint?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by unevenblue
    take pain to write some initials or hint?
    E's algorithm to compute the GCD.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by unevenblue View Post
    Okay. I know. Wait. I am beginner in learning C programming. I'll be glad if you elaborate your answer. Take pain to write some initials or hint?
    What you have is a math problem... when you understand how to solve it by pencil and paper, you will also have a good start on writing the code. Programmers don't simply get handed assignments and sit down to write code... the problem being that nobody, no matter how skilled, can write the solution to a problem they don't understand.

    This isn't the math department...

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    So you need to generate two numbers with a digit in common, then check whether removing the common digit gives you the same fraction as the original.

    (Math note: If you want to check whether a/b = c/d, then you actually check whether a*d = b*c, so that you don't have to deal with floating-point inaccuracies, et cetera.)

    You'll probably generate your pairs of numbers with some for-loops (one to go through all the possible common digits, one to go through the other digit on top, one to go through the other digit on the bottom).

Popular pages Recent additions subscribe to a feed

Tags for this Thread