CGI Interview Question: Write a code that takes an in... | Glassdoor

Interview Question

Entry-Level Applications Developer, Belton, TX Interview Belton, TX

Write a code that takes an input number and outputs the sum

  of all the EVEN numbers from that number down to zero. Write a function that, given a number as input, returns the factorial of that number.

Interview Answer

2 Answers


With the factorial question - ask if prefer as iteration or recursion.
SQL - INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (5, 'Smith', 'Mary')

Interview Candidate on Jan 22, 2013

while loop tests for number > 0 containing an if test that checks for number % 2 == 0

Interview Candidate on Apr 1, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.