Posted by: aaitey December 11, 2014
Adults ONLY !
Login in to Rate this Post:     0       ?        
अहिलेको जमानामा यसो हल्का गुगल गर्नु पर्छ क्या, गुला खेलाउदै दिमाग चलाउन खोजेर मात्र हुदैन।

http://codepad.org/Hrj8BKZ7

int getMissingNo (int a[], int n)
{
    int i, total;
    total  = (n+1)*(n+2)/2;  
    for ( i = 0; i< n; i++)
       total -= a[i];
    return total;
}
 
/*program to test above function */
int main()
{
    int a[] = {1,2,4,5,6};
    int miss = getMissingNo(a,5);
    printf("%d", miss);
    /*getchar();*/
}
Last edited: 11-Dec-14 03:05 PM
Read Full Discussion Thread for this article