Results 1 to 2 of 2

Math Help - Rwcursive Alogrithm

  1. #1
    Newbie
    Joined
    Oct 2008
    Posts
    2

    Rwcursive Alogrithm

    Using the fact that
    a mod 7 = (a7) mod 7, give a recursive algorithm for
    computing
    F(a) = a mod 7.
    The input
    a is a nonnegative integer and the output F(a) is a nonnegative
    integer between 0 and 6 (e.g.
    F(20) = 6).
    Write the algorithm as follows:

    procedure F(a)
    if _________
    then ___________
    else
    ___________________
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Aug 2006
    Posts
    18,714
    Thanks
    1642
    Awards
    1
    procedure F(a)
    if  a<7
    then a
    else  F(a-7)
    Follow Math Help Forum on Facebook and Google+

Search Tags


/mathhelpforum @mathhelpforum