Sum of User Defined Matrix Powers

Hi. First i have to express that, im newbie on C programming but i never want the whole code, just ask my question to give a lead or maybe some pseudo codes. Now heres my question;

I want user to enter a number lower than 100(e.g: k) which is the last number for the calculation. The calculation shud be like that, A + A^2 + A^3 + ... + A^k. BTW matrices gonna be square matrix as already defined before this section.

Thanx in advance. All answers will be appreciated.