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.



Write a C Program to declare an array for 2 0 floats. Accept the values from the user sort the tw..

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

Post New Answer

More IT Management Interview Questions

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')

4 Answers  


Why are you interested in this position? Our company?

0 Answers   IBM, YT,


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

0 Answers  


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.

0 Answers   Thought Works,


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.

0 Answers  


purpose of assigning Field Status Variant to Company code??

0 Answers  


What would your former boss/colleagues say about you?

1 Answers   TATA,


what do u mean by altkey?

0 Answers  


What is computer-based information system (CBIS) mean?

0 Answers  


what is difference between a primary market and secondary market in us economy as per e-commerce point of view ?

1 Answers  


what is the difference between BI and pervasive BI?

1 Answers   NIIT,


Categories
  • Business Administration Interview Questions Business Administration (517)
  • Marketing Sales Interview Questions Marketing Sales (1279)
  • Banking Finance Interview Questions Banking Finance (3209)
  • Human Resources Interview Questions Human Resources (747)
  • Personnel Management Interview Questions Personnel Management (68)
  • Hotel Management Interview Questions Hotel Management (29)
  • Industrial Management Interview Questions Industrial Management (113)
  • Infrastructure Management Interview Questions Infrastructure Management (14)
  • IT Management Interview Questions IT Management (97)
  • Supply Chain Management Interview Questions Supply Chain Management (16)
  • Operations Management Interview Questions Operations Management (39)
  • Funding Interview Questions Funding (79)
  • Insurance Interview Questions Insurance (494)
  • Waste Management Interview Questions Waste Management (1)
  • Labor Management Interview Questions Labor Management (48)
  • Non Technical Interview Questions Non Technical (73)
  • Business Management AllOther Interview Questions Business Management AllOther (546)