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

Define vptr.

0 Answers  


Please explain class & object in c++?

0 Answers  


Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.

0 Answers  


Brief explaination about #include<iostream.h>, cin and cout

3 Answers  


Read the following program carefully and write the output of the program. Explain each line of code according to given numbering. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> 1……………… int main (void) { pid_t pid; 2………………………… pid = fork(); 3…………………………. if (pid > 0) { int i; 4………………………… for (i = 0; i < 5; i++) { 5………………… …………… printf(" I AM VU : %d\n", i); 6………………… …………… sleep(1); } exit(0); } 7………………… ……… else if (pid == 0) { int j; for (j = 0; j < 5; j++) { 8……………………………… printf(" I have no child: %d\n", j); sleep(1); } _exit(0); } else { 9………………………………fprintf(stderr, "can't fork, error %d\n", errno); 10……………… … ………… exit (EXIT_FAILURE); } }

1 Answers  






Definition of class?

12 Answers  


What is an inline function in c++?

0 Answers  


What is function overloading in C++?

0 Answers  


Why c++ is not a pure oop language?

0 Answers  


How can you quickly find the number of elements stored in a dynamic array?

0 Answers  


Eplain extern keyword?

0 Answers  


Can a Structure contain a Pointer to itself?

0 Answers  


Categories