Skip to content

Instantly share code, notes, and snippets.

@efernandesng
Created May 20, 2014 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efernandesng/d721468d443136b20ee3 to your computer and use it in GitHub Desktop.
Save efernandesng/d721468d443136b20ee3 to your computer and use it in GitHub Desktop.
#include <stdio.h>
static int inicial = 1;
static int final = 5;
int
main (int argc, char **args)
{
int cont = 0;
int pos = inicial;
while (pos <= final && cont <= final)
{
printf ("%d ", pos);
if (cont == pos - 1)
{
pos++;
cont = 0;
}
else
cont++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment