if array a conatins 'n' elements and array b conatins 'n-1'
elements.array b has all element which are present in array
a but one element is missing in array b. find that
element.
Answer Posted / furquan
@Rasika : It will work even for array of characters i.e.
string. It will calculate on the ascii value.
int main()
{
char a[] = "abcghs", b[] = "abchs";
int sum = 0,i;
int n = strlen(a);
for (i=0;i<n-1;i++){
sum += a[i] - b[i];
}
sum += a[i];
printf("%c\n",sum);
return 0;
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is the difference between %d and %i?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
What is the heap in c?
What language is c written?
Is c pass by value or reference?
What are qualifiers and modifiers c?
Explain how can I prevent another program from modifying part of a file that I am modifying?
What are type modifiers in c?
What is difference between stdio h and conio h?
Explain Basic concepts of C language?
How do we declare variables in c?
What is mean by data types in c?
What is the difference between functions abs() and fabs()?
find the sum of two matrices and WAP for it.