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.

Answers were Sorted based on User's Feedback



There is a array of 99 cells and we have to enter 1-100 elements in it , no two elements would rep..

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

There is a array of 99 cells and we have to enter 1-100 elements in it , no two elements would rep..

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

More C++ General Interview Questions

What is a storage class in C++

1 Answers  


Can you use the function fprintf() to display the output on the screen?

0 Answers  


A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.

0 Answers  


Explain the difference between abstract class and interface in c++?

0 Answers  


How is an Abstract Base Class(ABC) related to an "Abstract Data Type" (ADT)

2 Answers  


Can we remove an element in a single linked list without traversing? Lets suppose the link list is like this 1 2 3 4 5 6 We need to remove 4 from this list (without traversing from beginning) and the final link list shud be 1 2 3 5 6 only thing we know is the pointer to element "4". How can we remove "4" and link "3" to "5"?

6 Answers   CSC,


How can virtual functions in c++ be implemented?

0 Answers  


Is C++ case sensitive a) False b) Depends on implementation c) True

0 Answers  


When one must use recursion function? Mention what happens when recursion functions are declared inline?

0 Answers  


What is a binary file? List the merits and demerits of the binary file usagein C++.

0 Answers  


What is the difference between *p++ and (*p)++ ?

0 Answers  


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

0 Answers  


Categories