Brian Chrzanowski



1 to 100

I saw recently, a programming interview question along the lines of:

Write a program to print the numbers, One to One Hundred without numbers in source code.

And it just sounded like a fun little exercise. Give it a try before you take a peek at the solution.
























/* 
 * Brian Chrzanowski
 * 2021-03-26 02:15:28
 *
 * print the numbers from one to one hundred without using numbers in code
 */

#include <stdio.h>

int main(int argc, char **argv)
{
    int i, limit;

    limit = (~argc) & argc;
    // alternatively, this would do
    // for (; --argc;)
    //     ;
    // limit = argc;

    limit++;
    limit += limit;
    limit *= limit;
    limit++;
    limit += limit;
    limit *= limit;

    for (i = limit - limit; ++i <= limit;) {
        printf("%d\n", i);
    }

    return limit - limit;
}