Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C Programming You have to write a program that will read an array from a file and sort the given array. You will return

In C Programming

You have to write a program that will read an array from a file and sort the given array. You will return the array sorted with all even numbers in ascending order at the front followed by all odd numbers in descending order. You may assume that input array will not have more than 20 elements (i.e., max size is 20). You can use any sorting algorithm you know or wish to use. However, you cannot use the library sort functions. You should write your own sort function. Input-Output format: Your program will take the file name as input. The first line in the file provides the total number of values in the array. The second line will contain a list of numbers separated by tabs. For example a sample input file file1.txt is: 6 25 10 1 99 4 2 Your output will be the sorted list of numbers, even numbers (ascending) and then odd numbers (descending), each separated by tabs. $./first file1.txt 2 4 10 99 25 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions