please write the program
3
Attachments:

Answers
Answered by
1
Answer:
import java.util.*;
class Function{
int n;
int r;
double F;
Function(){
n=0;
r=0;
F=0.0;
}
public static void main(String args[]){
Scanner in =new Scanner(System.in);
Function ob= new Function();
ob.readNum();
F= ob.factorial(n);/ ob.factorial(r); * ob.factorial(n-r);
ob.show();
}
void readNum(){
System.out.println("Enter the value of n");
n=in.nextInt();
System.out.println("Enter the value of r");
}
int factorial(int d){
int i,fact=1;
for(i=1;i<=d;i++){
fact= fact*i;
}
return fact;
}
void show(){
System.out.println("F="+F);
}
Explanation:
Above code is written in java using scanner class
hope it helps you!
devanshidisha:
thanks a bunch
Similar questions