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 / amty

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

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

Is This Answer Correct ?    41 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we make any program in c++ without using any header file and what is the shortest program in c++.

617


What is function overriding in c++?

606


What is a try block?

642


How many namespaces are there in c++?

563


What are the various compound assignment operators in c++?

553






What is the this pointer?

637


How would you obtain segment and offset addresses from a far address of a memory location?

622


What are the advantages of prototyping?

569


Why c++ is so important?

613


When does the c++ compiler create temporary variables?

575


What is encapsulation in C++? Give an example.

590


What is the difference between a "copy constructor" and an "assignment operator" in C++?

622


What apps are written in c++?

607


When is the copy constructor called?

637


What is &x in c++?

561