Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 50c195c1b85576000200005b

fib.c cleanup

cleanup the file

Start file
/* Fibonacci Series c language */
#include<stdio.h>
 
main()
{
   int n, first = 0, second = 1, next, c;
 
   printf("Enter the number of terms\n");
   scanf("%d",&n);
 
   printf("First %d terms of Fibonacci series are :-\n",n);
 
   for ( c = 0 ; c < n ; c++ )
   {
      if ( c <= 1 )
         next = c;
      else
      {
         next = first + second;
         first = second;
         second = next;
      }
      printf("%d\n",next);
   }
 
   return 0;
}
End file
/* Fibonacci Series c language */
#include<stdio.h>

main()
{
    int n, first = 0, second = 1, next, c;

    printf("Enter the number of terms\n");
    scanf("%d",&n);

    printf("First %d terms of Fibonacci series are :-\n",n);

    for ( c = 0 ; c < n ; c++ )
    {
        if ( c <= 1 )
            next = c;
        else
        {
            next = first + second;
            first = second;
            second = next;
        }
        printf("%d\n",next);
    }

    return 0;
}

View Diff

diff --git a/input.txt b/output.txt
index 2256c5a..aeb1794 100644
--- a/input.txt
+++ b/output.txt
@@ -1,27 +1,27 @@
/* Fibonacci Series c language */
#include<stdio.h>

main()
{
    int n, first = 0, second = 1, next, c;

    printf("Enter the number of terms\n");
    scanf("%d",&n);

    printf("First %d terms of Fibonacci series are :-\n",n);

    for ( c = 0 ; c < n ; c++ )
    {
        if ( c <= 1 )
            next = c;
        else
        {
            next = first + second;
            first = second;
            second = next;
        }
        printf("%d\n",next);
    }

    return 0;
}

Solutions by @Xelrifos:

Unlock 1 remaining solutions by signing in and submitting your own entry
Created by: @DiffJunk

55 active golfers, 68 entries

Solutions by @Xelrifos:
16
#35 - Xelrifos / @Xelrifos

02/23/2014 at 12:41PM