|
|
вернуться в форумpackage practice; import java.util.Scanner; public class Factorial { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner (System.in); System.out.println("enter the no"); int num = sc.nextInt(); String s = sc.next();
int k = s.length(); int fact = 1;
if(num %k ==0){ for(int i = num; i>=k; i = i-k){ fact = fact*i; } } else { for(int i =num; i >0; i = i-k){ fact = fact*i; } }
System.out.println(fact); } } |
|
|