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 |
YOU ARE COMING FROM CITY "A" AND WANT TO REACH "B". 3 ROADS MEET AT JUNCTION 'X',TO/FROM A,B,AND C. AT X,2 PERSON ARE STANDING-1ALWAYS SAY TRUTH ,ANOTHER ALWAYS SAY LIE. IN ONLY ONE QUESTION,HOW WILL YOU ASK THE WAY TO 'B'(YOU ARE COMING FROM 'A')
Why are you interested in this position? Our company?
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.
1 Answers EWR, MAH, SCDL Symbiosis Center for Distance Learning, Symbiosis,
what is data base management system and give their uses in marketing sector or day to day life
I'm working with a crosstab in cognos now. Page 1 contains crosstab Page 2 contains list Fact - Revenue Dimension - Product line, Year If I click on the revenue (cell value) it should goto the particular record in another list which is located in a separate page. However, the fact could not be bookmarked. I don't know why. Do you have suggestions? Thanks in advance.
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.
purpose of assigning Field Status Variant to Company code??
What would your former boss/colleagues say about you?
what do u mean by altkey?
What is computer-based information system (CBIS) mean?
what is difference between a primary market and secondary market in us economy as per e-commerce point of view ?
what is the difference between BI and pervasive BI?