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

A network diagram for a hospital database. Consider your own set of processes for the hospital.

3149


What are your strengths and talents?

1960


What are the key performance indicators of Business process analyst?

2931


expline the relevance of economic meltdown and the cost accounting

1931


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.

2150


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

3153


What are the Roles and Responsibilities of BDM in IT Industry ? And Tell me some thing about about IT industries

4115


what is the difference between BI and BW security?

2212


If you are a team lead in any IT company, and two employees are under your supervision. If one employee is good and other cannot behave professionally and personally, then how will you handle this situation?

2304


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

2330


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

1854


I'm working with a crosstab in cognos now. Page 1 contains crosstab Page 2 contains list Fact - Revenue Dimension - Product line, Year If I click on the revenue (cell value) it should goto the particular record in another list which is located in a separate page. However, the fact could not be bookmarked. I don't know why. Do you have suggestions? Thanks in advance.

2196


cost accounting is a tool for dicission making expline

1871


When you are given to develop a computer based information system for banking, how do you write the SDLC diagram?. Explain the five phases with respect to banking.

3004


why u choose mba after bca?

26517