write a programe to find the factorial of given number
using recursion
Answers were Sorted based on User's Feedback
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 |
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 |
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What is an example of enumeration?
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?
What is || operator and how does it function in a program?
Explain data types & how many data types supported by c?
Differentiate call by value and call by reference?
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack
What are valid signatures for the Main function?
in which language c language is written?
How can you determine the size of an allocated portion of memory?
i need all types of question paper releted to "c" and other language.