| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/deepi-ka/Java-Programs/master/Basic-Programs/factorial.java | [Back] [Original] |
import java.util.Scanner;
class Factorial
{
public static void main(String args[])
{
int n, c, f = 1;
System.out.println("Enter an integer to calculate its factorial");
Scanner in = new Scanner(System.in);
n = in.nextInt();
if (n < 0)
System.out.println("Number should be non-negative.");
else
{
for (c = 1; c
| Web Proxy Viewer | New URL | Original Page |