Home » Sometech » WAP in JAVA that implements FACTORIAL of a Given number.

WAP in JAVA that implements FACTORIAL of a Given number.

Java Coding

import java.util.Scanner;

class fact

{

public static void main(String arg[])

{

int number;

int fact=1;

Scanner ss=new Scanner(System.in);       

System.out.println(“enter the number”);

number=ss.nextInt();

for(int i=(number-1);i>1;i–)

{

fact=fact*i;

}

System.out.println(“fact of no. is=”+fact);

}

}

Advertisements

SoME Tech

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: