What's New-Given Below
technicalsymposium
technicalsymposium
technicalsymposium

C/C++ Lab Program(s)/Materials

C Program for factorial using recursion.

#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int a,b=0,c;
clrscr();
printf("Enter the N value:");
scanf("%d",&a);
while(a<0)
{printf("\n\Enter only positive number.\n");
printf("Enter N value:");
scanf("%d",&a);
}
b=fact(a);
printf("%d",b);
getch();
}
int fact(int x)
{
if(x==0)
{
return(1);
}
else
{
return((x)*(fact(x-1)));
}
}

More Lab Programs with Answers -Given Below-Click and Get Freely

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com