pascal程式設計輸入同學的成績,求出平均分和總分,然後從高到低排序,求解

2022-02-24 16:24:19 字數 1804 閱讀 3985

1樓:五書雁

program ex_1;

varx,y,z:integer;

procedure px(var a,b:integer); //排序的過程

vari:integer;

begin

if abegin

i:=a;

a:=b;

b:=i;

end;

begin

read(x,y,z);

writeln((trunc(x+y+z)/3),』 『,x+y+z); //輸出平均分(trunc取整數部位)和總分

px(x,y); //進行排序px(y,z);

px(x,y);

write(x,y,z);

end.

2樓:

program aaa;

vara:array[1..3]of longint;

i,zong,j,t:longint;

ping:real;

begin

for i:=1 to 3 do

begin

read(a[i]);

inc(zong,a[i]);

end;

ping:=zong / 3;

for i:=1 to 2 do

for j:=i to 3 do

if a[i]

begin

t:=a[i];

a[i]:=a[j];

a[j]:=t;

end;

writeln(zong); (輸出總分)writeln(ping); (輸出平均分)for i:=1 to 3 do

write(a[i],' '); (由高到低輸出)readln;

readln;

end.

3樓:天天快樂天天快樂樂

var n,i,j:integer;

begin

readln(n);

for i:=1 to n do

begin

write(' ':30-i);

for j:=1 to i do write(j);

for j:=i-1 downto 1 do write(j);

writeln;

end;

readln;

end.

4樓:匿名使用者

定義:a:array[1..3]of longint;

i,j,y,z:longint;

begin

讀入:for i:=1 to 3 do read(a[i]);

冒泡:for i:=1 to 3-1 dofor j:=i+1 to 3 do

if a[i]

總分:z:=0;

for i:=1 to 3 do inc(z,a[i]);

或者 : z:=0; z:=z+a[1]; z:=z+a[2]; z:=z+a[3];

輸出:writeln('原始成績從大到小');

for i:=1 to 3 do

write(a[i],' ');

writeln('總分');

writeln(z);

writeln('平均分,取整');

writeln(z div 3);

end.

程式設計實現統計同學c語言成績的各分數段人數

不難,就是字多.經測試沒有問題 include int main 記錄同學分數的陣列 int frac100 0 以下都是各分段的人數 int frac90 99 0 int frac80 89 0 int frac70 79 0 int frac60 69 0 int frac50 59 0 in...

程式設計 輸入1 90的整數,分類統計

include include include include include include include include include using namespace std 1701 1651 3186 2084 3126 1562 2485 3264 2255 int main for ...

c語言程式設計輸入英文數字,輸出相應的數字

include int main 只要你獲取的這個字元數字減去 0 即可 include int main void else return 0 include int main void else return 0 c語言程式設計 輸入一個小於100的整數,輸出相應的英文單詞。include st...