There is a array of 99 cells and we have to enter 1-100
elements in it , no two elements would repeat , so the is one
no. missing because 99 cells and 1-100 nos. so we had to
implement a function to find that missing no.

Answer Posted / shiva sahu

Get the sum of numbers
total = n*(n+1)/2

Subtract all the numbers from sum and
you will get the missing number.

this is not mine,but this ans is right

Is This Answer Correct ?    22 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the syntax for a for loop?

603


What are the types of pointer?

554


When is the copy constructor called?

635


Explain polymorphism?

586


How many characters are recognized by ANSI C++?

901






Describe friend function & its advantages.

716


What is the difference between the parameter to a template and the parameter to a function?

638


What is the average salary of a c++ programmer?

547


What is static function? Explain with an example

560


What is the need of a destructor?

638


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

590


What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard

593


How do we balance an AVL Tree in C++?

643


What do c++ programmers do?

558


How does the copy constructor differ from the assignment operator (=)?

625