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 BI and pervasive BI?
what is your self n what is your hobise n why?
How do you monitor risks to the project and mitigate them?
Why are you interested in this position? Our company?
Write a C Program to create a structured data file named Student.dat to store the roll no, name and course. Provide following functions: 1. Accept the values from the user using structure variables. Store the contents in a file. 2. Display the file. 3. The user should be able to add new records to the existing file. And display the new file.
4 Answers ABC, Chowgule, CMS, CSC, IBM, Practical Viva Questions, Student, Symbiosis, University Exams,
How do you manage suppliers?
1 Answers ABC, Pick n Pay, Safeway,
how to face telephonic round interview as a candidate. Kindly give me the tips. I am going to facing the telephonic interview for the post of IT networking sales Executive I am currently working with the same company Distributor . This is my Ist Interview in my life. My English is not very good
2 Answers Amazon, Camex Infomatix, FSL, GE, HCL, MAQ Software, Ocwen, TCS, Tech Mahindra,
Describe some of your most important career accomplishments
What is security policy? To protect an organization’s information what security policy need to follow according to you.
what is capital
Do you personally involved with Major incident process ? If yes, how do you manage it in your present organization ? explain with real scenario !
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?