Professional Documents
Culture Documents
}
Output :-
846
588
486
Program 2
Aim :- Problem on ProbabilityTheory.
// This is a program to generate a random number based on probability Desity
function of Spiner.
import java.util.Random;
}
Output :-
0.019444444444444445
0.05305555555555556
0.08166666666666668
0.08194444444444444
0.07861111111111112
0.07361111111111111
0.003333333333333334
0.017777777777777778
0.06527777777777778
0.08361111111111111
Program 3
Aim :- Problem on Permutations & Combinations
// Program to find Permutations and combinations of given numbers.
import java.util.Scanner;
Output :-
Enter Value of n : 5
Enter Value of r : 2
NCR is 10
NPR is 20
Program 4
Aim :- Problem on Derivatives.
// program to find derivatives.
public class program4 {
public String derivative(String number)
{
//get coefficient : everything before x
int coefficient
=Integer.parseInt(number.substring(0,number.indexOf("x")));
int newcoefficient=coefficient*exponent;
exponent=exponent-1;
return newcoefficient+"x^"+exponent;
}
Output :-
Mean :30.0
Median :30.0