{"comment":{"url":"https://api.github.com/repos/adioadeniran123/recursive/comments/10551265","html_url":"https://github.com/adioadeniran123/recursive/commit/d24ab38acd0cf5fa3b4ee9cfc2c65adb0bf0893a#commitcomment-10551265","id":10551265,"user":{"login":"ypolycarp","id":11678048,"avatar_url":"https://avatars.githubusercontent.com/u/11678048?v=3","gravatar_id":"","url":"https://api.github.com/users/ypolycarp","html_url":"https://github.com/ypolycarp","followers_url":"https://api.github.com/users/ypolycarp/followers","following_url":"https://api.github.com/users/ypolycarp/following{/other_user}","gists_url":"https://api.github.com/users/ypolycarp/gists{/gist_id}","starred_url":"https://api.github.com/users/ypolycarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ypolycarp/subscriptions","organizations_url":"https://api.github.com/users/ypolycarp/orgs","repos_url":"https://api.github.com/users/ypolycarp/repos","events_url":"https://api.github.com/users/ypolycarp/events{/privacy}","received_events_url":"https://api.github.com/users/ypolycarp/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"d24ab38acd0cf5fa3b4ee9cfc2c65adb0bf0893a","created_at":"2015-04-02T17:58:50Z","updated_at":"2015-04-02T17:58:50Z","body":"#include <stdio.h>\r\n\r\n//recursive solution\r\nint factorial(unsigned int i)\r\n{\r\n   if(i <= 1)\r\n   {\r\n      return 1;\r\n   }\r\n   return i * factorial(i - 1);\r\n}\r\n\r\n//iterative solution\r\nint factorial(int n)\r\n{\r\nint p = 1;\r\nint i;\r\nfor(i=n;i>=1;i--)\r\np* = i;\r\n\r\nreturn p;\r\n}\r\n\r\nint  main()\r\n{\r\n    int i = 15;\r\n    printf(\"Factorial of %d is %d\\n\", i, factorial(i));\r\n    return 0;\r\n}\r\n"}}