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 / 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 |
What is BID ADMINISTRATION?
Describe your ideal job and/or boss.
why u choose mba after bca?
Why general ledger accounts require "post automatically" setting in SAP??
In SAP SD , HOw to remove the materail block ?
what is the difference between BI and pervasive BI?
How we do trimming in Solaris and how to prevent the /var from become disk full.
What are the practices you follow for closing a project and meeting the conditions required to establish closure?
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 difference between a primary market and secondary market in us economy as per e-commerce point of view ?
Does S5700-24TP-SI-AC support dual power?
How do you manage suppliers?
1 Answers ABC, Pick n Pay, Safeway,
Business Administration (517)
Marketing Sales (1279)
Banking Finance (3209)
Human Resources (747)
Personnel Management (68)
Hotel Management (29)
Industrial Management (113)
Infrastructure Management (14)
IT Management (97)
Supply Chain Management (16)
Operations Management (39)
Funding (79)
Insurance (494)
Waste Management (1)
Labor Management (48)
Non Technical (73)
Business Management AllOther (546)