Skip to content
Browse files

Sum of Pairs: C solutions by Hardy Jonck

  • Loading branch information...
1 parent 81c6ce4 commit d759fd64c950868a424b2cc09091c773d7803e66 @apauley committed Sep 18, 2009
Showing with 10 additions and 0 deletions.
  1. +10 −0 CodeSnippets/SumPairs/sumpairs.c
View
10 CodeSnippets/SumPairs/sumpairs.c
@@ -0,0 +1,10 @@
+// C solution by Hardy Jonck
+
+#include <stdio.h>
+
+int main (int argc, const char * argv[]) {
+ int a[] = {1,2,3,4,5};
+ char x;
+ for (x=0; x<sizeof(a)/sizeof(int)-1; x++) { a[x] += a[x+1];printf("%d,",a[x]);}
+ return 0;
+}

0 comments on commit d759fd6

Please sign in to comment.
Something went wrong with that request. Please try again.