write a function that accepts an array A with n elements and
array B with n-1 elements. Find the missing one in array
B,with an optimized manner?
Answer Posted / vaibhav nigam
// missing number= diff in sum of 2 arrays
int missing_number(int A[], int B[], int n)
{
int sum1=0;
for(int i=0; i<n; i++) {
sum1+=A[i];
}
int sum2=0;
for(int i=0; i<n-1; i++) {
sum2+=B[i];
}
return (sum1-sum2);
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
#include
I came across some code that puts a (void) cast before each call to printf. Why?
What is derived datatype in c?
why programs in c are running with out #include
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
will u please send me the placement papers to my mail???????????????????
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
What does == mean in texting?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
Is c is a low level language?
What is typedef example?
What is getch () for?
Why calloc is better than malloc?
What does struct node * mean?
When the macros gets expanded?