write a programe to find the factorial of given number
using recursion

Answers were Sorted based on User's Feedback



write a programe to find the factorial of given number using recursion..

Answer / hari

int fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    13 Yes 4 No

write a programe to find the factorial of given number using recursion..

Answer / hari.11

t fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    2 Yes 2 No

write a programe to find the factorial of given number using recursion..

Answer / jessie

import util.java.Scanner
class factorial
{
public static void main(string arge[])
{
Scanner s=new Scanner(System.in);
int n=new int();
n=s.nextInt();
fact(n);
fact(int n)
{
if(n==1)
return 1;
else
return (n*fact(n-1));
}
System.out.println("the factorial of number is "+n);
}
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

What's the difference between a linked list and an array?

14 Answers  


can you change name of main()?how?

3 Answers   HCL, Siemens,


What is non linear data structure in c?

0 Answers  


Is c language still used?

0 Answers  


plz let me know how to become a telecom protocol tester. thank you.

0 Answers  






What do you mean by c what are the main characteristics of c language?

0 Answers  


write a c/c++ programthat connects to a MYSQL server and checks if the INNoDB plug in is installed on it.If so your program should print the total number of disk writes by MYSQL.

0 Answers   BirlaSoft,


how can i sort numbers from ascending order and descending order using turbo c..

1 Answers  


What is the significance of an algorithm to C programming?

0 Answers  


What is volatile variable in c?

0 Answers  


How will you declare an array of three function pointers where each function receives two ints and returns a float?

0 Answers   TISL,


Describe the header file and its usage in c programming?

0 Answers  


Categories