This is fairly easy, all you need is to modify the time_base of the video stream. For simple container formats such as AVI you only need to do it in the header. If you insist to do it via ffmpeg API, you'd need to loop through all the frames in the input stream, and copy them to the output stream.
The above assumes you only want to change the FPS (i.e. slow down or speed up the video) without dropping frames. However if you want to keep the video playback at the original speed while changing the FPS, you'd need to recode the video, i.e. decode and encode each frame, while inserting extra frames or removing some frames. You cannot simply remove the frames from the video - for example when converting from 30FPS to 15FPS you cannot simply remove every 2nd frame, since it may be a keyframe and it will break all frames after it until the next keyframe is encountered. Same way, you cannot simply duplicate a frame when upping the FPS, as P frames apply only to the frame before it, so duplicating it would break your video. For this which I'd suggest to look at my Karaoke Lyric Editor source code, notably video decoding and video encoding.