Home > Back-end >  Small white [to help] C because online classes require two to write small programs
Small white [to help] C because online classes require two to write small programs

Time:11-30

1. Design a program to calculate the input of the lowest value of 20 integers, maximum and average,

2. Write a program, h value from the keyboard input, the output of the row with * of h parallelogram, example: input h=4, graphic output are as follows:

* * * *

* * * *

* * * *

* * * *

Is really too stupid don't understand to this piece of hope bosses at odd bit helped give me a little busy thank you very much

CodePudding user response:

Int n=0, d=INT_MIN, x=INT_MIX, j=0, g=0;
While (g + + & lt; 20) cin> N, (n> d? D=n: 0), (x> n? X=n: 0) j +=n:
Cout CodePudding user response:

The answer is too complicated for beginners, upstairs or simply use an array to calculate it

CodePudding user response:

#include
Int main ()
{
Int a, d;
22,2,3,4,99,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 int I [20]={};
Int xiao=I [0], da=I [0];
For (a=1; a<=19; +)
{
If (xiao> I [a])
Xiao=I [a];

}
For (a=1; a<=19; +)
{
If (daDa=I [a];
}

Printf (" maximum value for: % d, the minimum: % d \ n ", da, xiao);

return 0;
}

CodePudding user response:

Question one: # include
Int main ()
{
Int a, d;
22,2,3,4,99,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 int I [20]={};
Int xiao=I [0], da=I [0];
For (a=1; a<=19; +)
{
If (xiao> I [a])
Xiao=I [a];

}
For (a=1; a<=19; +)
{
If (daDa=I [a];
}

Printf (" maximum value for: % d, the minimum: % d \ n ", da, xiao);

return 0;
}
The second question:
#include
Int main ()
{
Int h=4;
for(int i=0; i<4. I++)
{
For (int j=I; J<4. J++)
{
printf(" ");

}
Printf (" * * * * \ n ");
}


return 0;
}

  • Related