Q:

C Program to identify missing Numbers in a given Array

0

C Program to identify missing Numbers in a given Array

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
 
void main()
{
    int n, i, j, c, t, b;
 
    printf("Enter size of array : ");
    scanf("%d", &n);
    int array[n - 1];     
    printf("Enter elements into array : \n");
    for (i = 0; i < n - 1; i++)    
        scanf("%d", &array[i]);
    b = array[0];
    for (i = 1; i < n - 1; i++)
        b = b ^ array[i];
    for (i = 2, c = 1; i <= n; i++)
        c = c ^ i; 
    c = c ^ b;  
    printf("Missing element is : %d \n", c);
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now