1. Engineering
  2. Computer Science
  3. develop c programing language and here i attached program and...

Question: develop c programing language and here i attached program and...

Question details

develop c programing language and here I attached program and you can add left c program and give me screenshort of output

  1. Develop a program that accepts integers from command line, sorts the integers into ascending order, computes the sum of the integers, and counts the number of even numbers and the number of odd numbers.

/*Template for the program*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int
main(int argc, char * argv[])
{
int i=0, data[argc-1], Sum=0, EvenCount=0, OddCount=0;
for (i=1; i<argc; i++) /*convert strings to integers*/
{
data[i-1] = atoi(argv[i]);
if ((data[i-1]%2) == 0) EvenCount++;
else /*do odd count here*/
Sum=Sum+data[i-1];
}
/* Use array data[] to do sorting here
then output the results with statement like printf("Sum=%d\n", Sum);

*/

}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution