how about
int p07EvenFactorial(int n) {
if (n % 2 == 1) {
n--;
}
int fact = 1;
for (int i = 2; i <= n; i = i + 2) {
fact = fact * i;
}
return fact;
}
More Related Contents:
- Program that asks user how many times it wants to loop for (java)
- Why my program crash when i press back Button
- How to turn off the Eclipse code formatter for certain sections of Java code?
- Cannot create or edit Android Virtual Devices (AVD) from Eclipse, ADT 22.6
- How does a for loop work, specifically for(;;)?
- CreateProcess error=206, The filename or extension is too long when running main() method
- Reference is ambiguous with generics
- How to change font size in Eclipse for Java text editors?
- How to create a project from existing source in Eclipse and then find it?
- How to enable the Java keyword assert in Eclipse program-wise?
- How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX?
- Eclipse Error: Could not find or load main class [duplicate]
- Is there any way to do n-level nested loops in Java?
- Java 8 forEach with index [duplicate]
- eclipse/tomcat: deploy doesn’t work any more (ClassNotFoundException)
- Super class method and Interface default method conflict resolution
- Java object ID in jvm
- maven-archetype-webapp eclipse problem
- Find unused classes in a Java Eclipse project
- How to solve maven 2.6 resource plugin dependency?
- Bug in eclipse compiler or in javac (“type parameters of T cannot be determined”)
- R.raw.anything cannot be resolved [duplicate]
- Writing a new refactoring plugin for Eclipse?
- Cannot load properties file from resources directory
- Is this a memory leak or a false positive?
- How to Use Eclipse to Debug JNI code (Java & C/C++)
- Eclipse – Show generated class files
- java swing component cannot be resolved
- Removing all types of comments in java file
- How do I add the Java API documentation to Eclipse?