just to give you a few key words to look for try typing into google "C while loop" or "C for loop" or "recursion tutorial"(this one is a bit more advanced)