Draw the Sawtooth Alphabet

C, 134

n,m,c,p;
main(r){
for(scanf("%d",&n),m=--n?n*2:1;n+r--;puts(""))
for(c=-1,p=1;c++<25;)
p+=(c-n-r)%m*((c-n+r)%m)?1:1-printf("%*c",p,c+65);
}

Compiles on gcc with a few warnings. Newlines aren't included in the character count.

122 characters if the input is already stored in n.

Thanks to user2992539, tolos and edc65 for improvements.


if n holds the height:

C + escape codes: 81

x;main(y){for(y=n--;x<26;x++)printf("\033[%d;%dH%c",n?x/n&1?y++:y--:y,x+1,x+65);}

C: 110

x;char a[702]={[0 ...701]=32};main(y){for(y=--n;x<26;a[x*27-1]=10)a[27*(n?x/n&1?y++:y--:y)+x]=x+++65;puts(a);}

TI-BASIC - 148 bytes (raw text), 186 bytes (graphic)

In response to the OP, the wonderful TI-83 (and newer) comes with a size of 16 x 8 (just using the standard large text) or with a size of 94 x 62 pixels (which with small text is worth about 10 lines).

Now, this has a little problem (to which I would like clarification). The size impositions can't be "ignored" by the interpreter; in other words, if we were to try to set the sawtooth height at 20, it would give an error preventing the full execution of the code. I could write code that would, in an infinite environment, produce the correct output, except it wouldn't run on the machine.

With this being said, I present you the (running) versions of the programs. They all depend on the variable N being set to the desired height in lines before running:

  • Raw text approach

    :ClrHome
    :"ABCDEFGHIJKLMNOPQRSTI-BASICUVWXYZ"→Str1
    :8→R
    :For(C,1,16
    :If N=1
    :Then
    :0→F
    :Else
    :If R<2 or 10-R>N
    :1→F
    :If R>7
    :-1→F
    :End
    :If C≠20
    :Then
    :Output(R,C,sub(Str1,C,1
    :Else
    :Output(R,C,sub(Str1,C,8
    :C+7→C
    :End
    :R+F→R
    :End
    

    In order to make this work regardless of the terminal, change For(C,1,16 to For(C,1,33 and remove the upper bound checking (R<2 or). Here is the output with 5→N:

    enter image description here

  • Graphic approach (this may also need AxisOff for clarity)

    :ClrDraw
    :N*6→N
    :"ABCDEFGHIJKLMNOPQRSTI-BASICUVWXYZ"→Str1
    :57→R
    :For(C,1,56
    :If N=6
    :Then
    :0→F
    :Else
    :If R<7 or 64-R>N
    :6→F
    :If R>51
    :-6→F
    :End
    :If C≠20
    :Then
    :If C>50
    :Then
    :Text(R,C,sub(Str1,C-23,1
    :Else
    :Text(R,C,sub(Str1,C,1
    :End
    :Else
    :Text(R,C,sub(Str1,C,8
    :C+30→C
    :End
    :R+F→R
    :End
    

    This one works OK, with two minor quirks. The height is still a problem, although the width isn't. However, I didn't space the letters, so in some cases (when the letter starts to rise or decline from the sawtooth), the letters may be chopped off by their successors. To make it work regardless of the terminal, remove the upper bound check (R<7 or). Then follows the graph:

    enter image description here