Question: Could you rewrite the C program and tell me where I have gone wrong? Write a program to arrange a set of fruit names in

Could you rewrite the C program and tell me where I havegone wrong? Write a program to arrange a set of fruit namesCould you rewrite the C program and tell me where I have gone wrong?

Write a program to arrange a set of fruit names in lexicographically sorted order. Input format The first line of the input consists of the value of n. Next n input is the fruit names. Output format The output prints the fruit names in lexicographically sorted order. Sample testcases Input 1 Output 1 8 mango banana apple apple banana coconut grapes mango orange papaya watermelon orange grapes coconut watermelon papaya 2 #include 3 #include 4 int main() 5-{ 6 char name[20][10], t_name[15][10], temp[10]; 7 int i,j,n; 8 scanf("%d ",&n); 9 for(i=0;i0) 19 { 20 strcpy(temp, name[i]); 21 strcpy(name[i], name[j]); 22 strcpy(name[j], temp); 23 } 24 } 25 } 26 for(i=0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!