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

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?

1760


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

3870


What change management processes have you used to ensure that change is introduced properly?

2954


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?

2091


i was looking for a general example for time management and how everything is linked together so i can have a complete picture. when i say link i mean with OM and PA and work schedule,planned working time, other relevant infotypes, personnel area and subarea and their groupings, etc...

2047






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

1630


why u choose mba after bca?

25537


expline the relevance of economic meltdown and the cost accounting

1702


what is the difference between BI and BW security?

1994


Why are you interested in this position? Our company?

3750


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

1812


what do u mean by altkey?

1949


From where I should start to prepare for cat?

1728


Describe some of your most important career accomplishments

4238


what is capital

2126