Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}
added 7 characters in body
Source Link
sigalor
  • 231
  • 1
  • 3

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}
added 7 characters in body
Source Link
sigalor
  • 231
  • 1
  • 3

C, 78 7070 67 bytes

f(i,j){for(i=0;++i<27;puts;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Try it on IdeoneTry it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}

C, 78 70 bytes

f(i,j){for(i=0;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}
Made use of the fact that there only needs to be a function instead of a whole program (suggested by owacoder).
Source Link
sigalor
  • 231
  • 1
  • 3
Loading
Source Link
sigalor
  • 231
  • 1
  • 3
Loading