Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Sum recursion in C code example

Example: c program to find the sum of given number using recursion

# include <stdio.h>
int sum(int number);
int main
{
 int n;
 int a;
 printf("enter a number");
 scanf("%d,&n);
 a=sum(n);
 printf("sum=%d",a);
 }
int sum(int number)
{
  if (number==0)
    return 0;
  return(number%10+sum(number/10);
 }

Tags:

Javascript Example

Related

reverse method for linked list in java code example Write code that finds maximum value from a list of 100 integer elements in pl/1 code example is there anyway to limit decimals for doubles code example how to update docker compose version in ubuntu code example how to clear cookies google chrome code example enter a Div Vertically and Horizontally with margin code example docker find images in repository code example for statement in one line python code example Response Code : 200 code example append to array c++ code example angular css ng-deep to only one component code example override in javascript class code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy