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.

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the key performance indicators of Business process analyst?

2710


hi i am doing cause study about Enterprising young IT Entrepreneur who has recently started a small business running web hosting services for SME (Small to Medium Enterprise). You frequently need to meet (potential) clients to sell your services to them. You do so with presentations and demonstrations of your products. You will also want to install certain development software for your software development projects. So what software to use? need a server? what types of hosting should i use?

1771


Hi, I worked TCS (BA) third party for only 18 days. After that i didnt go to office due to some problem. i send resign letter through mail.Just i want to know whether its affect my career.? also my consultant is drop the mail TCS is ben for me so its true ...i need to pull back agin try. so its posssible Pls guide me

1092


expline the relevance of economic meltdown and the cost accounting

1713


what is erp manufacturing perspective??

3903






wahat ae technical terms associated with the Oracle modules. example - HR related - HRMS or HCM

1937


What id the meaning of MIS ? MIS nasure, charactersitcs, purpose ? how can the leanr about them ?

2069


This is related to Medical Transcription field. As i am above to get the call from the company, I just want to prepare for the interview for the post of Auditor and I have just never faced the telephonic interview and very rare attempted the interview in companies as I have worked for very few companied.

1972


Is any one has SAP GTS( Global Trade Services)Reading and Exercise material. If so, please e-mail me.

3295


sir iam going for an interview on feb 2nd week and i would like too ask questions that they will pose too me 1:i hav choosen conchordia wisconsin why these university what should b my answer 2:i had selected mis in mba from conchordioa university why these course if they question wat should b my answer 3:and last question is wat is guarantee u will come bck my dad works as a production manager in saudi arabia soo wat should b my anser too them because i am going for mba wat should b my answer for return gurantee pls reply too me it will b gr8 off u yours sicerly

1632


In the creation of the material master if user maintains MRP Type as ‘VB’ (Manual reorder point planning) unless until user will not maintain the Reorder point Qty & fixed lot size Qty system will not allow creating the material which is right process. Hence the same rule should be applied for MRP Type ‘ND’ also. So that user cannot fill the MRP Data unless he will not choose ‘VB’

2814


i am going for the IT Officer written test,can any body mail me the question bank to Pragyanmund@rediffmail.com

1937


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

2934


why u choose mba after bca?

25592


Why are you interested in this position? Our company?

3754