programming icon indicating copy to clipboard operation
programming copied to clipboard

Added Recursion Problems of C language

Open sneh-chauhan opened this issue 6 years ago • 1 comments

Pull Request checklist -

  • [ ] This pull request fixes #issue_reference (Create an issue if not already present.)
  • [ ] The directory structure is of the form (directory_name) (If directory doesn't exist, create a new.)
  • [ ] Don't duplicate stuff.

Make sure all the above conditions are met before a PR is created.

sneh-chauhan avatar Oct 06 '20 20:10 sneh-chauhan

Yes correct! Thanks😀

On Fri, Oct 16, 2020, 9:06 AM Gareeb [email protected] wrote:

@Gareeb-coder commented on this pull request.

In Recursion/factorial.c https://github.com/hacktoberfest17/programming/pull/2185#discussion_r506027304 :

+#include<stdio.h> +int sum(int); +main() +{

  • int x,z;
  • printf("Enter the value of x:\n");
  • scanf("%d",&x);
  • z=sum(x);
  • printf("The sum of %d numbers is %d.\n",x,z); +} +int sum(int a) +{
  • int s;
  • if(a==1)
  •    return(a);
    
  • s=a*sum(a-1);

There is no need of s variable here, u can also write like this return( asum(a-1) );*

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hacktoberfest17/programming/pull/2185#pullrequestreview-509988604, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARF7GA2DBZH3CL4LAVI33FTSK65UDANCNFSM4SGPUSPQ .

sneh-chauhan avatar Oct 16 '20 09:10 sneh-chauhan