Current location - Education and Training Encyclopedia - Resume - C language programming questions, enter n positive integers (10

# include & ltiostream & gt

Use namespace std

int main()

{

int N = 1;

int num[20]= { 0 };

int

C language programming questions, enter n positive integers (10

# include & ltiostream & gt

Use namespace std

int main()

{

int N = 1;

int num[20]= { 0 };

int

C language programming questions, enter n positive integers (10

# include & ltiostream & gt

Use namespace std

int main()

{

int N = 1;

int num[20]= { 0 };

int max,min,sum = 0;

float ava = 0;

And (! (N & gt 10。 & ampN & lt= 20))

{

Cout & lt& lt "Please enter a value for n:"

CIN & gt; & gtn;

}

Cout & lt& lt Please enter n positive integers, and the Enter key ends! & lt& ltendl

for(int I = 0; I & ltn;; i++)

CIN & gt; & gtnum[I];

max = num[0];

min = num[N- 1];

for(int I = 0; I & ltn;; i++)

{

if(num[I]& gt; Max)

max = num[I];

if(num[I]& lt; Minimum)

min = num[I];

sum+= num[I];

}

Ava = (floating point) and/n;

Cout & lt& lt "Maximum quantity:"

Cout & lt& lt "Minimum quantity:"

Cout & lt& lt "Total:"

Printf ("average: %.2f", ava);

//cout & lt; & lt "Average value:"

System ("suspended");

Returns 0;

}