Good interview Questions

This is a discussion on Good interview Questions within the C++ Programming forums, part of the General Programming Boards category; Having array[99] and i am trying to assigning the 1 to 100 numerical values in the array in any manner ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    4

    Good interview Questions

    Having array[99] and i am trying to assigning the 1 to 100 numerical values in the array in any manner and no duplicate values in the array there will be one missing number . Find the missing number .

    Give the solution in C or C++

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Code:
    DWORD MissingNumber = 5050;
    
    for(int x = 0;x<99;x++) MissingNumber -= array[x];
    Missing number will now contain the missing number.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  3. #3
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    478
    Quote Originally Posted by abachler View Post
    Code:
    DWORD MissingNumber = 5050;
    
    for(int x = 0;x<99;x++) MissingNumber -= array[x];
    Missing number will now contain the missing number.
    That's an awesome solution. Wouldn't have come up with that myself.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Good interview Questions
    By rupendranaidu in forum C Programming
    Replies: 2
    Last Post: 08-21-2009, 06:43 AM
  2. Good Programming schools are they out there???
    By jbarby in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-12-2009, 06:31 PM
  3. Any good tutorials?
    By kimmag in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2008, 06:44 AM
  4. What are some good books on C?
    By php111 in forum C Programming
    Replies: 9
    Last Post: 10-01-2008, 06:16 AM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21