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

Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

0 Answers  


What is an example of enumeration?

1 Answers  


what will be the output: main(){char ch;int a=10;printf("%d",ch);}

36 Answers   Accenture, TCS, Wipro,


Is c is a middle level language?

0 Answers  


What is || operator and how does it function in a program?

0 Answers  






Explain data types & how many data types supported by c?

0 Answers  


Differentiate call by value and call by reference?

0 Answers   Cyient,


What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack

6 Answers  


What are valid signatures for the Main function?

0 Answers  


in which language c language is written?

2 Answers  


How can you determine the size of an allocated portion of memory?

0 Answers   Aspire, Infogain,


i need all types of question paper releted to "c" and other language.

0 Answers  


Categories