Code optimization (for a competition)

closed account (ShpjE3v7)
Hi, can we optimize more this code?

main(){int n,i;scanf("%i",&n);while(n--){scanf("%i",&i);printf("%d\n",(i+1)*i/2);}}

What kind of optimization are you after? It looks like you are trying to write the program in as few characters as possible but that will not affect the run-time performance.
closed account (ShpjE3v7)
Yes, I know. The code must be just as short as possible and,
evidently, works.
Write it in J
Topic archived. No new replies allowed.