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 d scanf?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
c language interview questions & answer
what does static variable mean?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
What does it mean when a pointer is used in an if statement?
Is file a keyword in c?
Is it fine to write void main () or main () in c?
Ow can I insert or delete a line (or record) in the middle of a file?
diff between exptected result and requirement?
What is pointer to pointer in c?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
When a c file is executed there are many files that are automatically opened what are they files?
What are the types of type specifiers?