Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. Whole Number Ratios

Whole Number Ratios

Scheduled Pinned Locked Moved Algorithms
algorithms
2 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MikeMarq
    wrote on last edited by
    #1

    Does anyone know of a good algorithm for calculating minimum whole number ratios. For instance: 800x600 would be 4x3 300x110 would be 30x11 250x150 would be 5x3 thanks in advance

    C 1 Reply Last reply
    0
    • M MikeMarq

      Does anyone know of a good algorithm for calculating minimum whole number ratios. For instance: 800x600 would be 4x3 300x110 would be 30x11 250x150 would be 5x3 thanks in advance

      C Offline
      C Offline
      cp9876
      wrote on last edited by
      #2

      Simply divide by the greatest common divisor (gcd) 800x600 gcd(800,600)=200 so you get 4x3 etc You calculate gcd using Euclid's algorithm, Wikipedia article[^]

      Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups