You created the same thread more than once and also in the wrong forum and I have moved them into C-C++ forum for better response.

Also regarding your question I guess you need to look into using loops because this question is just a one line program using loops