In honor of the 100th problem of the day today's problem will be to print out the numbers 1-100 and 100-1. To be clear you must print out each number 1-100 and then 100-1. Try to optimize for the number of characters used. Fewest number of characters wins!
Comments:
Lasharn - 10 years, 9 months ago
This answer is kinda cheaty since it's not a programming language so to speak but on MATLAB just go:
disp(1:100); disp(100:-1:1);
reply permalink
Anonymous - 10 years, 9 months ago
On shell I can just do
seq 1 100;seq 100 -1 1
reply permalink
Anonymous - 10 years, 9 months ago
haskell :
or print instead of show, but show is one char shorter :D maybe i get something better, but i dunno
reply permalink
Anonymous - 10 years, 9 months ago
It took longer in C++ but still, looks clean.
reply permalink
Anonymous - 10 years, 9 months ago
C#
reply permalink
Anonymous - 10 years, 9 months ago
was able to make it a bit smaller
reply permalink
James - 10 years, 9 months ago
Compile with 'gcc -std=99'
reply permalink
Anonymous - 10 years, 9 months ago
You can still do it C90 as
#include<stdio.h>
main(){int i=0;for(;i<202;i++)printf("%d\n",i<101?i:201-i);}
reply permalink
Anonymous - 10 years, 9 months ago
In Ruby:
reply permalink
Nick Krichevsky - 10 years, 9 months ago
Python
print range(101),range(101)[::1]
reply permalink