<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>recursion | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/recursion/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Wed, 28 Dec 2022 15:39:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Recursion</title>
		<link>https://studentprojects.in/software-development/cpp/recursion/</link>
					<comments>https://studentprojects.in/software-development/cpp/recursion/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Wed, 11 Jan 2023 03:38:00 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[recursion]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10086</guid>

					<description><![CDATA[<p>Recursion is the process of a function calling itself, and the function that is doing it is referred to as a recursive function. A base condition and a recursive condition make up the recursive function. Recursive functions need a base case to ensure that the recursion ends; otherwise, they will run indefinitely, which is not</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/recursion/">Recursion</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Recursion is the process of a function calling itself, and the function that is doing it is referred to as a recursive function. A base condition and a recursive condition make up the recursive function.</p>



<p>Recursive functions need a base case to ensure that the recursion ends; otherwise, they will run indefinitely, which is not what you want. The basic case is the scenario in which the function doesn&#8217;t recur. The base case, for instance, is when we attempt to use recursion to get the factorial of a number and our number ends up being less than 1.</p>



<p>The formula used to get a number&#8217;s factorial is an illustration of a recursive function.</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">int factorial(int n){
    if (n == 0 || n == 1){
        return 1;
    }
    return n * factorial(n - 1);
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/recursion/">Recursion</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/recursion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C Program for Binary Search and Towers of Hanoi using Recursion</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-for-binary-search-and-towers-of-hanoi-using-recursion/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-for-binary-search-and-towers-of-hanoi-using-recursion/#respond</comments>
		
		<dc:creator><![CDATA[Ansten Lobo]]></dc:creator>
		<pubDate>Sat, 09 Jun 2012 16:55:20 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Towers of Hanoi]]></category>
		<category><![CDATA[binary search]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[c program]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=3319</guid>

					<description><![CDATA[<p>C Program for Binary Search and Towers of Hanoi using Recursion. Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT main() { int n,a[50],key,opn,i,pos; do { clrscr(); printf(" \n\n Press 1 -> Binary Search , 2-> Towers of Hanoi 3-> Quit\n"); scanf("%d",&#038;opn); switch(opn) { case 1: printf(" How Many Elements?"); scanf("%d",&#038;n); printf("</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-for-binary-search-and-towers-of-hanoi-using-recursion/">C Program for Binary Search and Towers of Hanoi using Recursion</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>C Program for Binary Search and Towers of Hanoi using Recursion.<br />
Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT</p>
<pre lang="C" line="1">
main()
{
    int n,a[50],key,opn,i,pos;
    do
    {
        clrscr();
        printf(" \n\n Press 1 -> Binary Search , 2-> Towers of Hanoi 3-> Quit\n");
        scanf("%d",&opn);
        switch(opn)
        {
        case 1: printf(" How Many Elements?");
            scanf("%d",&n);
            printf(" Read all the elements is ASC order \n");
            for(i=1;i<=n;i++)
                scanf("%d",&#038;a[i]);
            printf(" Read the Key Element\n");
            scanf("%d",&#038;key);
            pos=BS(a,key,1,n);
            if(pos)	 printf(" Success: %d found at %d \n", key,pos);
            else	 printf(" Falure: %d Not found in the list ! \n",key);
            break;
        case 2: printf("\n\n How Many Disks ?");
            scanf("%d", &#038;n);
            printf("\n\n Result of Towers of Hanoi for %d Disks \n",n);
            tower(n,'A','B','C');
            printf("\n\n Note: A-> Source, B-> Intermediate, C-> Destination\n");
            break;
        case 3: printf(" Terminating \n"); break;
        default: printf(" Invalid Option !! Try Again !! \n");
        }
        printf(" Press a Key. . . ");  getch();
    }while(opn != 3);
}
int BS(int a[], int key,int low,int high)
{
    int mid;
    if(low > high) return 0; /* failure */
    else
    {
        mid=(low+high)/2;
        if(a[mid]== key) return mid; /* Success */
        if(key < a[mid]) return(BS(a,key,low,mid-1));
        return(BS(a,key,mid+1,high));
    }
}
tower(int n, char src, char intr, char dst)
{
    if(n > 0)
    {
        tower(n-1,src,dst,intr);
        printf("Move disk %d from %c to %c \n", n,src,dst);
        tower(n-1,intr,src,dst);
    }
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-for-binary-search-and-towers-of-hanoi-using-recursion/">C Program for Binary Search and Towers of Hanoi using Recursion</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-for-binary-search-and-towers-of-hanoi-using-recursion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to calculate the factorial of a number using recursion.</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-calculate-the-factorial-of-a-number-using-recursion/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-calculate-the-factorial-of-a-number-using-recursion/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sun, 04 Apr 2010 12:56:18 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[calculate factorial]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[c programs]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1134</guid>

					<description><![CDATA[<p>Write a program to calculate the factorial of a number using recursion. #include #include void main() { int n,fact; int rec(int); clrscr(); cout>n; fact=rec(n); cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-calculate-the-factorial-of-a-number-using-recursion/">C++ program to calculate the factorial of a number using recursion.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Write a program to calculate the factorial of a number using recursion.</p>
<pre lang="cpp">
#include<iostream.h>
#include<conio.h>
void main()
{
	int n,fact;
	int rec(int); clrscr();
	cout<<"Enter the number:->";
	cin>>n;
	fact=rec(n);
	cout<<endl<<"Factorial Result are:: "<<fact<<endl;
	getch();
}
rec(int x)
{
	int f;
	if(x==1)
		return(x);
	else
	{
		f=x*rec(x-1);
		return(f);
	}
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-calculate-the-factorial-of-a-number-using-recursion/">C++ program to calculate the factorial of a number using recursion.</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-calculate-the-factorial-of-a-number-using-recursion/feed/</wfw:commentRss>
			<slash:comments>20</slash:comments>
		
		
			</item>
		<item>
		<title>Java program to print Fibonacci sequence</title>
		<link>https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-print-fibonacci-sequence/</link>
					<comments>https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-print-fibonacci-sequence/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 02 Oct 2009 14:50:28 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java programs]]></category>
		<category><![CDATA[Fibonacci sequence]]></category>
		<category><![CDATA[non-recursive]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[recursion]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=850</guid>

					<description><![CDATA[<p>Write a Java program that uses both recursive and non-recursive functions to print nth value in the Fibonacci sequence.</p>
<p>The post <a href="https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-print-fibonacci-sequence/">Java program to print Fibonacci sequence</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Write a Java program that uses both recursive and non-recursive functions to print nth value in the Fibonacci sequence</p>
<p><strong>Without recursion:</strong></p>
<pre lang="java" escaped="true" line="1">
import java.util.Scanner;
class fibonacci
{
	public static void main(String[] input)
	{
		int x,y;
		x=Integer.parseInt(input[0]);
		y=Integer.parseInt(input[1]);
		Scanner s=new Scanner(System.in);
		System.out.println(“Enter the value of n:”);
int n=s.nextInt();
		int z[]=new int[n];
		z[0]=x;
		z[1]=y;
		for(int i=2;i<n;i++)
		{
			z[i]=z[i-1]+z[i-2];
		}
		for(int i=0;i<n;i++)
		{	
			System.out.println(z[i]);
		}
	}
} 
</pre>
<p><strong>With recursion:</strong></p>
<pre lang="java" escaped="true" line="1">
import java.util.Scanner;
class fibonacci
{
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		System.out.println(“Enter the value of n:”);
		int n=s.nextInt();
		fiboni f1=new fiboni();
		System.out.println(f1.fibon(n));
	}
}
class fiboni
{
	public int fibon(int a)
	{
		if(a==0 || a==1)
			return 1;
		else
			return fibon(a-1)+fibon(a-2);
	}
}
</pre>
<p><strong>Output:</strong></p>
<p>10</p>
<p>1<br />
1<br />
2<br />
3<br />
5<br />
8<br />
13<br />
21<br />
34<br />
55</p><p>The post <a href="https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-print-fibonacci-sequence/">Java program to print Fibonacci sequence</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-print-fibonacci-sequence/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
