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
cost accounting is a tool for dicission making expline
Why general ledger accounts require "post automatically" setting in SAP??
what four attribut in business case?
7. (a) How do you implement internal controls in IT systems? (b) How to design internal controls over financial reporting, when financial reporting is performed totally from the software application? Explain briefly the major points. (c) What are the additional controls needed, when the software interfaces are webbased? Explain the materiality of the payroll processing functions to be performed by webinterfaces from the control perspective.
Describe some of your most important career accomplishments
What type of questions will be asked in Bank of India Computer Officers (IT) exam? Will someone provide me the sample paper of Bank of India Computer Officer (IT) exam?
what is variable?
What unique experience or qualifications separate you from other candidates?
what is erp manufacturing perspective??
How we do trimming in Solaris and how to prevent the /var from become disk full.
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.
Why are you interested in this position? Our company?
I didn't see any category for Project Management. What are the activities, documents; how to plan, schedule and monitor tasks, statuses, people...?
what do you mean by "Closures with help of Top Management and Colleagues"
What are the Roles and Responsibilities of BDM in IT Industry ? And Tell me some thing about about IT industries