Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int ilog10(int n);
- /* last-reply-thread: generate replies to max number of comments possible */
- int main(int argc, char *argv[])
- {
- int postnum;
- int countout = 0;
- int linesize = 0;
- postnum = atoi(argv[1]);
- while (countout <= 2000) {
- if (linesize)
- printf(">>%d ", postnum);
- linesize = 0;
- postnum += 1;
- linesize += ilog10(postnum)+1;
- linesize += 3; // ">>" and space
- countout += linesize;
- }
- return 0;
- }
- int ilog10(int num)
- {
- int d = 0;
- while (num /= 10)
- d++;
- return d;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement