Cisco Systems Interview Question
368 Interview Reviews |
Back to all Cisco Systems Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer at Cisco Systems:
Helpful Question?
Yes |
No
Inappropriate?



0 of 0 people found this helpful
by Maya:
public class Factorial {
public int factiorailIter(int n){
int res = 1;
if (n == 0){
return 1;
}
while (n > 0){
res *= n--;
}
return res;
}
public int factorialRec(int n){
if (n ==0){
return 1;
}
else {
return n * factorialRec(n-1);
}
}
public static void main (String[] args){
Factorial f = new Factorial();
System.out.println(f.factiorailIter(5));
System.out.println(f.factorialRec(5));
}
}