Thread: pythagoras triplets

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    3

    pythagoras triplets

    hi i need to creat a program that gives all pythagoras triplets and has a limit of 250
    0 < a <= b <= c < 250, a2 + b2 = c2
    each triplet needs to be in a line

    like:
    3,4,5
    5,12,13
    6,8,10
    and so on till 250-- the last one is 160,168,232

    i wrote this but for some reason there is someting missing since is gives me wrong triples?
    can someone help me


    pythagoras triplets-1-jpg

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Why are you printing i, a, and b instead of a, b, and c?

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    3
    never mind i fixed it!!

  4. #4
    Registered User TheBigH's Avatar
    Join Date
    May 2010
    Location
    Melbourne, Australia
    Posts
    426
    What does "i" even do?
    Code:
    while(!asleep) {
       sheep++;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. generating number triplets
    By Irony in forum C Programming
    Replies: 1
    Last Post: 10-06-2009, 09:21 AM
  2. Pythagoras theorm
    By newboy in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2002, 03:21 PM