How to do the Pascal problem Enter 10 numbers and display the difference between each number and th

Updated on technology 2024-03-18
14 answers
  1. Anonymous users2024-02-06

    The specific process is as Richardbao2000 said: 1, read 10 numbers.

    2. Find the average.

    3. Compare the 10 numbers with the average respectively.

    4. Output the result.

    var a:array[0..10]of real;

    i:integer;

    begina[0]:=0;

    for i:=1 to 10 do

    beginread(a[i]);

    a[0]:=a[0]+a[i]/10;

    end;writeln('everage:',a[0]:4:2);

    for i:=1 to 10 do

    write(a[i]-a[0]:4:2,' ');

    end.

  2. Anonymous users2024-02-05

    Read ten numbers.

    Find their averages.

    The difference between the ten numbers and the average number is displayed in turn.

  3. Anonymous users2024-02-04

    Integer should not be used because it represents an integer and can be changed to real

  4. Anonymous users2024-02-03

    In fact, this problem is not as troublesome as the upstairs, and there is no need to use arrays.

    You only need to read 1 number at a time, determine whether it is larger than the maximum value and smaller than the minimum value, and then add the total value (finally divide by 20 to find the average).

    var i,a,max,min,total:integer;i is a cyclic variable, a is the number of each read, max stores the maximum value, min stores the minimum value, and total stores the total number.

    beginmax:=-9999;min:=9999;total:=0;The initial value, max stores a very small number, min stores a large number, can understand the put. The total total, of course, was 0 at the beginning.

    for i:=1 to 20 do loop 20 times.

    beginread(a);Read in a number.

    if a>max then max:=a;To determine whether it is larger than max, it is to give a to max to ensure that max is always the largest.

    if atotal:=total+a;The total amount is added a

    end;writeln(max);Output maximum.

    writeln(min);Output a minimum value.

    writeln(total/20:1:5);The total number of outputs is divided by 20 (which is the average).

    end.Okay,That's pretty much it.,If you don't understand, please ask.。。。 Guaranteed originality (hit me for 20 minutes, give it points).

    Let's take it!!

    Weakly ask upstairs, what does it mean to die if you play].

  5. Anonymous users2024-02-02

    Does the maximum value refer to the largest of the 20 numbers?

  6. Anonymous users2024-02-01

    Ten numbers with the most primitive method:

    vara:array[1..10]of integer;

    i,j,t:integer;

    beginfor i:=1 to 9 do

    for j:=i+1 to 10 do

    if a[i]>a[j] then

    begint:=a[i];

    a[i]:=a[j];

    a[j]:=t;

    end;for i:=1 to 10 do write(a[i],' ');

    end.In this way, the 10 numbers are arranged in order from small to large.

  7. Anonymous users2024-01-31

    program a1;

    vara:array[1..100]of integer;

    beginread(n);[10 is assumed here].

    for i:=1 to n do read(a[i]);Enter this number of n (let's say 10).

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]begin

    max:=a[i];

    a[i]:=a[j];

    a[j]:=max;

    end;for i:=1 to n do

    beginwrite(a[i]:3);

    end;end.

    Adopt it, I've debugged it.

  8. Anonymous users2024-01-30

    Agree with Jaxxcyh!

    For the sake of what you don't know, I'll give you a reference program.

    var a:array[1..20]of real;

    n,m,b:real;

    i,j:integer;

    beginfor i:=1 to 20 do beginread(a[i]);

    if a[i]>m then m:=a[i];

    b:=b+a[i];

    end;readln;

    writeln('zuida=',m:0:2); b:=b/20;

    n:=a[1];

    for i:=2 to 20 do

    if a[i]writeln('zuixiao=',n:0:2);

    writeln('pinjun=',b:0:2);

    end.Because you didn't say whether it was an integer or a decimal, I did it by the decimal method.

  9. Anonymous users2024-01-29

    If you don't say "hurry up", I would like to help you a little, but I guess no one will want to help you solve the problem with this rude "hurry up" in front of you.

    You have to have some quality to be a man!

  10. Anonymous users2024-01-28

    Mouse over the blue bar.

    Right-click. Select Properties.

    Choose a good font (it is recommended that the dot matrix font is 7*12).

    Then press Layout.

    Fill it with the buffer.

    Refill the window size.

    Press OK when you're done.

  11. Anonymous users2024-01-27

    Right-click on the shortcut.

    Select "Properties"...

    Select the Layout tab.

    Then adjust the "buffer size."

    If you can use alt+enter to full screen.

    It is recommended that you use alt+enter....

  12. Anonymous users2024-01-26

    There are many ways to do this, and I'll tell you the easiest one: alt+enter, and the same goes for shrinking.

  13. Anonymous users2024-01-25

    Right-click on the bar window and you'll find the one that has a start.

    Select Properties, modify the font size, and you're good to go.

  14. Anonymous users2024-01-24

    Alt+enter shrinking is also this.

    Or tune in the properties.

Related questions
31 answers2024-03-18

The question you are talking about belongs to permutations and combinations and simple number theory. >>>More

23 answers2024-03-18

Wrong. Divide 5 by a number, and the remainder may be 1,2,3. It can't be 4. >>>More

10 answers2024-03-18

Here's a C implementation that assigns an array a[10] to p[n]: >>>More

12 answers2024-03-18

It seems that no, mathematicians and their computers in various countries are still trying to find larger prime numbers. If there is an equation, do you still have to find it this way? >>>More

5 answers2024-03-18

Try my way:

Create a text on the form, and a command1 >>>More