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 the difference between product based and service based IT companies?
Does S5700-24TP-SI-AC support dual power?
what is variable?
why do you join mba in IT sector?
cost accounting is a tool for dicission making expline
i am going for the IT Officer written test,can any body mail me the question bank to Pragyanmund@rediffmail.com
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.
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?
purpose of assigning Field Status Variant to Company code??
what is proxy?
Which managerial function gives attention to influencing and motivating employees to improve performance and achieve corporate objectives?
How do you monitor risks to the project and mitigate them?
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)