Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

plz answer..... a program that reads non-negative integer
and computes and prints its factorial

Answer Posted / vignesh1988i

USING RECURSION
#include<stdio.h>
#include<conio.h>
int factorial(int);
void main()
{
int n,c;
printf("enter the non negative number :");
scanf("%d",&n);
if(n>=0)
{
c=factorial(n);
printf("the factorial is : %d",c);
}
else
printf("only for non negative numbers factorial can be
computed");
getch();
}
int factorial(int n)
{
static i=1,fact=1;
fact=fact*i;
if(i==5)
return(fact);
else
factorial(++i);
}

iam back thank you

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell us two differences between new () and malloc ()?

1115


What are the 4 types of unions?

987


What is scope rule of function in c?

1029


Explain what’s a signal? Explain what do I use signals for?

1053


How to throw some light on the b tree?

1020


What is the difference between the expression “++a” and “a++”?

1159


What is the difference between malloc calloc and realloc in c?

1069


Are pointers integers in c?

1028


Are local variables initialized to zero by default in c?

983


What are the key features in c programming language?

1004


What is pragma in c?

1129


What are the usage of pointer in c?

1122


Does c have circular shift operators?

1182


How #define works?

1048


Give basis knowledge of web designing ...

1980