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 unique experience or qualifications separate you from other candidates?

7261


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?

1885


How we do trimming in Solaris and how to prevent the /var from become disk full.

1590


Describe your ideal job and/or boss.

4040


Can you help me what kind of PM interview questions company can ask based on below job description?: *Work with business development, editorial, marketing and other departments as needed to understand and prioritize project requests. *Work with online creative, IT, and development departments to gather and disseminate project requirements. *Maintain weekly web projects production calendar *Assist in the quality assurance process associated with code releases to development, staging and production servers. *Participate in planning meetings for new site initiatives. Document, clarify and articulate requirements and bring thoughts to the discussion. *Distribute reports summarizing project milestones and associated tasks. *Create rough wireframes and functional diagrams for developers using Microsoft Visio. *Work with third party vendors to procure services associated with web development. *Work with our partners to ensure deliverables and associated tasks stay on track. Can you help me what kind of PM question company can ask based on above job description?

2207






what is the difference between BI and pervasive BI?

5400


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

2181


what is variable?

2121


cost accounting is a tool for dicission making expline

1750


What are your strengths and talents?

1857


what do you mean by "Closures with help of Top Management and Colleagues"

2102


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

3059


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

3413


Why general ledger accounts require "post automatically" setting in SAP??

1605


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

1912