Write a C Program to declare an array for 2 0 floats.
Accept the values from the user
sort the two arrays in descending order. Merge the two
arrays into a new array and display
the new array.






Write a C Program to declare an array for 2 0 floats. Accept the values from the user sort the tw..

Answer / irfan fazli (trying to help tw

/* Build your program around this..... */
main()
{
int a, b, c;
float t;

/*declare an array for 2 0 floats*/
float aList1[20];
float aList2[20];
float aList[40];

/* Accept the values from the user */
/* 1 */
for (c=0; c++;c <20)
scanf("%f", alist1+c);
/* 2 */
for (c=0; c++;c <20)
scanf("%f", alist2+c);

/* sort the two arrays in descending order */
/* 1 */
for (a=0; a++; a <20)
for (b=a+1; b++; b <20)
if (aList1[a] < aList1[b])
{
t = aList1[a] ;
aList1[a] aList1[b] ;
aList1[b] =t ;
}

/* 2 */
for (a=0; a++; a <20)
for (b=a+1; b++; b <20)
if (aList2[a] < aList2[b])
{
t = aList2[a] ;
aList2[a] aList2[b] ;
aList2[b] =t ;
}

/* Merge the two arrays into a new array */
c=0;
while (a < 20 || b < 20)
if (aList1[a] > aList2[b])
aList[c++] = aList[a++]
else
aList[c++] = aList[b++]

/* display the new array */
for (c=0; c++;c <40)
printf("%f, ", alist1[c]);
printf("\n");
}

Is This Answer Correct ?    14 Yes 9 No

Post New Answer




More IT Management Interview Questions

what four attribut in business case?

0 Answers   Wipro,


why do you join mba in IT sector?

3 Answers  


why prototype is used?

1 Answers   Kaizen,


How do you manage suppliers?

1 Answers   ABC, Safeway, Pick n Pay,


Describe your ideal job and/or boss.

0 Answers  






what is variable?

0 Answers  


expline the relevance of economic meltdown and the cost accounting

0 Answers  


How retrive the deleted file frm UAT by doing migration in SAP BO 4.0

0 Answers   Accenture,


how to face telephonic round interview as a candidate. Kindly give me the tips. I am going to facing the telephonic interview for the post of IT networking sales Executive I am currently working with the same company Distributor . This is my Ist Interview in my life. My English is not very good

2 Answers   TCS, Amazon, Ocwen, Tech Mahindra, GE, Camex Infomatix, FSL, MAQ Software, HCL,


where do you see yourself after 5 or 10 years

4 Answers   Vodafone, Hotel Jobs,


What tools do you use to monitor and control projects?

5 Answers   Safeway,


DataStage 7.5 & DataStage 8.5 :Which Oracle Database version is supported as target datasource?

0 Answers  






Categories
  • Business Administration Interview Questions Business Administration (509)
  • Marketing Sales Interview Questions Marketing Sales (1036)
  • Banking Finance Interview Questions Banking Finance (2718)
  • Human Resources Interview Questions Human Resources (744)
  • Personnel Management Interview Questions Personnel Management (68)
  • Hotel Management Interview Questions Hotel Management (24)
  • Industrial Management Interview Questions Industrial Management (83)
  • Infrastructure Management Interview Questions Infrastructure Management (14)
  • IT Management Interview Questions IT Management (97)
  • Supply Chain Management Interview Questions Supply Chain Management (15)
  • Operations Management Interview Questions Operations Management (39)
  • Funding Interview Questions Funding (79)
  • Insurance Interview Questions Insurance (68)
  • Waste Management Interview Questions Waste Management (1)
  • Labor Management Interview Questions Labor Management (48)
  • Non Technical Interview Questions Non Technical (73)
  • Business Management AllOther Interview Questions Business Management AllOther (546)