ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1083. Factorials!!!

WA #1 , plz give wht I hv done wrng then only I can correct it
Posted by Paul 6 Nov 2012 23:32
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);
    }

}
Re: WA #1 , plz give wht I hv done wrng then only I can correct it
Posted by Axmadjon 30 Apr 2014 16:20
thank you