4. What is the output of the following program? import java.util.Scanner; public class nprandncr { //calculating a factorial of a number public static int fact(int num) { int fact=1, i; for(i=1; i


4. What is the output of the following program?<br>import java.util.Scanner;<br>public class nprandncr {<br>//calculating a factorial of a number<br>public static int fact(int num)<br>{<br>int fact=1, i;<br>for(i=1; i<=num; i++)<br>{<br>fact = fact*i;<br>%3D<br>}<br>return fact;<br>}<br>public static void main(String args])<br>{<br>int n, r;<br>Scanner scan = new Scanner(System.in);<br>System.out.print(

Extracted text: 4. What is the output of the following program? import java.util.Scanner; public class nprandncr { //calculating a factorial of a number public static int fact(int num) { int fact=1, i; for(i=1; i<=num; i++)="" {="" fact="fact*i;" %3d="" }="" return="" fact;="" }="" public="" static="" void="" main(string="" args])="" {="" int="" n,="" r;="" scanner="" scan="new" scanner(system.in);="" system.out.print("enter="" value="" of="" n="" :="" ");="" scan.nextint();="" system.out.print("enter="" value="" of="" r:="" ");="" r="scan.nextInt();" n="System.out.print("NCR" =="" "="" +(fact(n)/(fact(n-="" r)*fact(r))));="" system.out.print("nnpr="" r))));="" }="" }="" %3d="">

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here