Created
March 26, 2015 13:46
-
-
Save Sergaav/1da08f2f19862f27e7b9 to your computer and use it in GitHub Desktop.
Factorial 4<n<16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gmail.sergaav.dz3_5; | |
import java.util.Scanner; | |
public class dz3_5 { | |
public static void main(String[] args) { | |
double n; | |
double fact=1; | |
int i; | |
Scanner sc = new Scanner (System.in); | |
System.out.println("Input a:"); | |
n=sc.nextDouble(); | |
if (n>4 && n<16){ | |
for (i=1;i<=n;i++){ | |
fact=fact*i; | |
} | |
System.out.println(fact); | |
}else System.out.println("A must be 4<n<16"); | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment