A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2FFunction%2FFunction_Recursive</id>
		<title>C/Function/Function Recursive - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2FFunction%2FFunction_Recursive"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C/Function/Function_Recursive&amp;action=history"/>
		<updated>2026-04-17T22:40:40Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C/Function/Function_Recursive&amp;diff=296&amp;oldid=prev</id>
		<title> в 14:20, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C/Function/Function_Recursive&amp;diff=296&amp;oldid=prev"/>
				<updated>2010-05-25T14:20:56Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:20, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C/Function/Function_Recursive&amp;diff=297&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C/Function/Function_Recursive&amp;diff=297&amp;oldid=prev"/>
				<updated>2010-05-25T10:22:33Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==A recursive power function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
double power(double x, int n);&lt;br /&gt;
int main() {&lt;br /&gt;
  double x = 0.0;&lt;br /&gt;
  int n = 0;&lt;br /&gt;
  for(x = 2.0 ; x&amp;lt;= 5.0; x += 0.5)&lt;br /&gt;
    for(n = 0 ; n&amp;lt;5 ; n++)&lt;br /&gt;
      printf(&amp;quot;%.2lf raised to the power %d = %.2lf\n&amp;quot;, x, n, power(x,n));&lt;br /&gt;
}&lt;br /&gt;
/* Function to raise x to the power n.*/&lt;br /&gt;
double power(double x, int n) {&lt;br /&gt;
  if(n == 0)&lt;br /&gt;
    return 1.0;&lt;br /&gt;
  else&lt;br /&gt;
    return x * power( x , n - 1 );&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Calculating factorials using recursion==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
long factorial(long);&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  long number = 0;&lt;br /&gt;
  printf(&amp;quot;\nEnter an integer value: &amp;quot;);&lt;br /&gt;
  scanf(&amp;quot; %ld&amp;quot;, &amp;amp;number);&lt;br /&gt;
  printf(&amp;quot;\nThe factorial of %ld is %ld\n&amp;quot;, number, factorial(number));&lt;br /&gt;
}&lt;br /&gt;
/* recursive factorial function */&lt;br /&gt;
long factorial(long N)&lt;br /&gt;
{&lt;br /&gt;
  if( N &amp;lt; 2 )&lt;br /&gt;
    return N;&lt;br /&gt;
  else &lt;br /&gt;
    return N*factorial(N - 1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Copy string using recursion==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
void strcopy(char *s1, char *s2);&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  char str[80];&lt;br /&gt;
  strcopy(str, &amp;quot;this is a test&amp;quot;);&lt;br /&gt;
  printf(str);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void strcopy(char *s1, char *s2)&lt;br /&gt;
{&lt;br /&gt;
  if(*s2) { /* if not at end of s2 */&lt;br /&gt;
    *s1++ = *s2++;&lt;br /&gt;
    strcopy(s1, s2);&lt;br /&gt;
  }&lt;br /&gt;
  else *s1 = &amp;quot;\0&amp;quot;; /* null terminate the string */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Function: Recursive call==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
void f(int i);&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  f( 0 );&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
void f(int i)&lt;br /&gt;
{&lt;br /&gt;
  if( i &amp;lt; 10) {&lt;br /&gt;
    f( i + 1 ); /* recursive call */&lt;br /&gt;
    printf(&amp;quot;%d &amp;quot;, i);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Prints out Fibonacci numbers==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    int   old_number= 1;&lt;br /&gt;
    int   current_number = 1;&lt;br /&gt;
    int   next_number;&lt;br /&gt;
    while (current_number &amp;lt; 100) {&lt;br /&gt;
        printf(&amp;quot;%d\n&amp;quot;, current_number);&lt;br /&gt;
        next_number = current_number + old_number;&lt;br /&gt;
        old_number = current_number;&lt;br /&gt;
        current_number = next_number;&lt;br /&gt;
    }&lt;br /&gt;
    return (0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recursive function call==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int add(int pk,int pm);&lt;br /&gt;
main() {&lt;br /&gt;
    &lt;br /&gt;
   int k = 2;&lt;br /&gt;
   int i;&lt;br /&gt;
   int m = 3;&lt;br /&gt;
   i = add(k,m);&lt;br /&gt;
   printf(&amp;quot;i =  %d\n&amp;quot;,i);&lt;br /&gt;
}&lt;br /&gt;
int add(int addk,int addm) {&lt;br /&gt;
    if(addm==0) &lt;br /&gt;
        return(addk); &lt;br /&gt;
    else &lt;br /&gt;
        return(1+add(addk,addm-1));&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recursive function with static variable==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
void f(void);&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  f();&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
void f(void)&lt;br /&gt;
{&lt;br /&gt;
  static int s = 0;&lt;br /&gt;
  s++;&lt;br /&gt;
  if(s == 10) &lt;br /&gt;
      return;&lt;br /&gt;
  printf(&amp;quot;%d &amp;quot;, s);&lt;br /&gt;
  f(); /* recursive call */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>