K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

s=10; i=8

uses crt;

var i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

t:=0;

for i:=1 to 2*n do 

 if i mod 2=1 then t:=t+sqr(i);

writeln(t);

readln;

end.

uses crt;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(t/n:4:2);

readln;

end.

19 tháng 4 2021

viết lun dùm mình tính số TB cộng dương với số TB cộng âm với!!

 

Câu 1: 

1:A

2:C

Câu 1:

3:D

4:C

19 tháng 4 2021

câu 1:

a)for i:=17 to 109 do writeln('a');

b)for i:=1 to 10 do x:=x+1;

c)s:=7;

while s<=15 do

begin

n:=n+s;

s:=s+1;

end;

d)var a:array[1..100] of real;

câu 2:

program tihn_tong;

uses crt;

var s,i:integer;

begin

clrscr;

i:=1;s:=1000;

while i<=21 do

begin

s:=s+1000+i;

i:=i+1;

end;

writeln(s);

readln;

end.

câu 3:

cú pháp của lệnh for...to...do:

for<biến đếm>:=<giá trị đầu>to<giá trị cuối>do<công việc>

cú pháp của lệnh while...do:

while<điều kiện>do<công việc>

câu 4:

cú pháp khai báo biến mang trong chương trình pascal:

khai báo trực tiếp:

var <biến mảng>:array[chỉ số]of <kiểu dữ liệu>

khai báo gián tiếp:

type <biến mang> =array[chỉ số]of <kiểu dữ liệu>

 

Câu 1: 

a) for i:=17 to 109 do 

  writeln('a');

13 tháng 6 2021

Đề thi tin học trẻ BT phải ko b?

Mà bài này giải sao nhỉ?

Muốn xem code để tham khảo quá!!!

30 tháng 7 2021

sắp xếp lại các phần tử theo chiều tăng dần rồi đặt kết quả muốn tìm = 1, so sánh nó với từng phần tử trong mảng, nếu bé hơn thì dừng chương trình và đó là kết quả, nếu không thỉ cộng kết quả cho phần tử đang được so sánh.

code :

program giai;uses crt;var n,m,i,c,t : integer;A : array[1..100] of integer;beginclrscr;write('so phan tu cua day so :');readln(m);for i:=1 to m do    begin         readln(A[i]);    end;for i:= 1 to m do    for n:=i+1 to m do        if A[i] > A[n] then        begin        c:= A[i];        A[i] := A[n];        A[n] := c;        end;t:= 1;for i:=1 to m-1 do    if t < A[i]    then    break    else t:= t+ A[i];writeln(t);readln;end. 
18 tháng 4 2021

program tim_uoc;

uses crt;

var i,n,tong:integer;

begin

clrscr;

write('nhap so n:');readln(n);

i:=1;tong:=0;

writeln('cac uoc cua ',n,' la:');

while i<=n do

if n mod i=0 then

begin

write(i:3);

inc(i);

end;

writeln;

i:=1;writeln('cac uoc chan:');

while i<=n do

begin

if n mod i=0 then 

begin

if i mod 2=0 then write(i:3);

tong:=tong+i;

end;

end;

writeln;

write('tong cac uoc chan:',tong);

readln;

end.

uses crt;

var n,i,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

i:=1;

writeln('Cac uoc cua ',n,' la: ');

while i<=n do

  begin

if n mod i=0 then write(i:4):

i:=i+1;

end;

writeln;

writeln('Cac uoc chan cua ',n,' la: ');

t:=0;

i:=1;

while i<=n do 

  begin

if (n mod i=0) then

begin

t:=t+i;

write(i:4);

end;

inc(i);

end;

writeln('Tong cac uoc chan cua ',n,' la: ',t);

readln;

end.

18 tháng 4 2021

a)

var a:array[1..100] of longint;

      n,i,max,d:longint;

begin

read(n);

for i:=1 to n do

write('nhap chieu cao, don vi cm');read(a[i]);

b) max:=a[1];

for i:=2 to n do

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

writeln('ban cao nhat cao',max);

c) for i:=1 to n do

if a[i]>160 then d:=d+1;

write('so ban cao hon 160 cm la: ',d);

end.

 

18 tháng 4 2021

câu b,c ko cần khai báo lại đúng ko ạ?

Câu 1: 

uses crt;

var a:array[1..100]of integer;

i,n:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

 begin

write('A[',i,']='); readln(a[i]);

end;

for i:=1 to n do 

  if a[i]<0 then write(a[i]:4);

readln;

end.

Câu 2: 

uses crt;

var a:array[1..100]of integer;

i,n:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

 begin

write('A[',i,']='); readln(a[i]);

end;

for i:=1 to n do 

  if a[i]>0 then write(a[i]:4);

readln;

end.