Login

Create Account
Customer Service Chat
+14156709189
info@expertsmind.com
Submit Homework/Assignment
Get quote & make Payment
Get Solution
Small code have missing part, computer programming, Programming Languages
#question.
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Description:
* *
* Written by *** *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include
#include
#include
#define SIZE 10
#define BOUND (SIZE * SIZE)
int main(int argc, char **argv) {
/* We run the program with one number as command line argument and use it as a seed
* for the random number generator. */
srand(strtoul(argv[1], NULL, 10));
int data[SIZE];
/* We randomly generate 10 numbers in the range [0, 100) and store them in data. */
for (int i = 0; i < SIZE; ++i)
data[i] = rand() % BOUND;
int nb_of_odd_numbers = 0;
int nb_of_numbers_at_least_equal_to_50 = 0;
int min = BOUND  1;
int max = 0;
int gap = 0;
int inversions = 0;
/***********Missing code here************/
for (int i = 0; i < SIZE; ++i)
printf("%4d", data[i]);
printf("\n contains ");
nb_of_odd_numbers > 1 ?
printf("%d odd numbers,\n contains ", nb_of_odd_numbers) :
nb_of_odd_numbers ?
printf("1 odd number only,\n contains ") :
printf("no odd number at all,\n contains ");
nb_of_numbers_at_least_equal_to_50 > 1 ?
printf("%d numbers at least equal to 50, and\n ", nb_of_numbers_at_least_equal_to_50) :
nb_of_numbers_at_least_equal_to_50 ?
printf("1 number at least equal to 50 only, and\n ") :
printf("no number at least equal to 50 at all, and\n ");
printf("has %d as minimal value and %d as maximal value.\n", min, max);
printf("The maximal gap between two successive numbers is %d.\n", gap);
printf("There are %d occurrences of pairs of numbers (x, y) with x > y.\n", inversions);
return EXIT_SUCCESS;
}

the output should looke something like this:
Sample outputs
$ a.out 0
30 91 15 72 61 41 10 37 98 41
contains 6 odd numbers,
contains 4 numbers at least equal to 50, and
has 10 as minimal value and 98 as maximal value.
The maximal gap between two successive numbers is 76.
There are 22 occurrences of pairs of numbers (x, y) with x > y.
$ a.out 1
7 49 73 58 30 72 44 78 23 9
contains 5 odd numbers,
contains 4 numbers at least equal to 50, and
has 7 as minimal value and 78 as maximal value.
The maximal gap between two successive numbers is 55.
There are 24 occurrences of pairs of numbers (x, y) with x > y.
$ a.out 2
14 98 99 16 13 44 88 9 99 71
contains 5 odd numbers,
contains 5 numbers at least equal to 50, and
has 9 as minimal value and 99 as maximal value.
The maximal gap between two successive numbers is 90.
There are 21 occurrences of pairs of numbers (x, y) with x > y.
$ a.out 3
21 47 25 27 43 16 32 40 75 33
contains 7 odd numbers,
contains 1 number at least equal to 50 only, and
has 16 as minimal value and 75 as maximal value.
The maximal gap between two successive numbers is 42.
There are 16 occurrences of pairs of numbers (x, y) with x > y.
Posted Date: 3/10/2012 10:57:10 PM  Location : United States
Ask an Expert
Related Discussions:
Small code have missing part, computer programming, Assignment Help, Ask Question on Small code have missing part, computer programming, Get Answer, Expert's Help, Small code have missing part, computer programming Discussions
Write discussion on Small code have missing part, computer programming
Your posts are moderated
Write your message here..
Related Questions
Visual Basic 2010 Karate Payments MDI Application, The following are requir...
The following are required for this lesson: Complete the Project "Adding New Payments," which is the Karate Payments that includes the Adding New Payments, Deleting Payments,
Write a shell script to find the maximum of three numbers, W.A.S.S to find ...
W.A.S.S to find the maximum of three numbers Program # W.A.S.S to find the maximum of three numbers echo "Enter three No.:" read no1 read no2 read no3 if test $no1 gt $n
Write a function that will read the atoms for a protein, Write a function r...
Write a function readPDBfile('filename') that will read the atoms for a protein stored in a PDB file, whose name is provided as an input to the function (note that this name should
Implement a program that can draw graphs, 1. Implement a program where an e...
1. Implement a program where an ellipse follows the perimeter of the window. 2. Implement a program that can draw graphs, possibly following your plan from last week. Have it gr
Vb, sir can you help me visual basic 6.0 project solution
sir can you help me visual basic 6.0 project solution
Create program that displays levels of the fractal structure, In this Proje...
In this Project your task is to create a program that displays various levels of the fractal structure of the so called square shaped Sierpinskicarpet. The display of level 4 is s
Program for connect 4 game on a general board, The classical connect4 game...
The classical connect4 game is played on a 67 board, it can in fact be played in any nrRowsnrCols board. In your implementation, the user will specify the number of rows nrRows an
Algorithm of sort the given array remove the repeated value, Short Arrays: ...
Short Arrays: Array = randi(10,1,randi(6,1,1)+4)5 This command will generate an array which you should be able to evaluate by hand (and also have your code evaluate for te
GUI(VB.NET), Can you please make my assignment in 3 days?I will pay you goo...
Can you please make my assignment in 3 days?I will pay you good
Shell script to count characters, Normal 0 false false fals...
Normal 0 false false false ENUS XNONE XNONE MicrosoftInternetExplorer4
Assignment Help
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
IT Courses and Help
ExpertsMind Services
Online Tutoring
Projects Assistance
Exam Preparation
Coursework Help
Programming Courses
Engineering Courses
Why Us ?
~Experienced Tutors
~24x7 hrs Support
~Plagiarism Free
~Quality of Work
~Time on Delivery
~Privacy of Work