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.

16 tháng 2 2022

Program bt_1;

Uses crt;

Var Tong, n, i: integer;

Begin

 Clrscr;

 Writeln(‘nhap n=’);

 Readln (n);

 Tong:=0;

 For i:=1 to n do

 If I mod 2 = 1 then Tong:= Tong+i;

 Writeln(‘Tong la:’,Tong);

 Readln

End.

uses crt;

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

i,n:integer;

min,t:real;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

min:=a[1];

for i:=1 to n do 

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

writeln('Gia tri nho nhat la: ',min:4:2);

t:=0;

for i:=1 to n do 

 if i mod 2=0 then t:=t+a[i];

writeln('Tong cac phan tu co chi so chan la: ',t:4:2);

readln;

end. 

11 tháng 4 2023

BT1: 

Uses crt;

var i,n: integer;

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

begin clrscr;

readln(n);

for i:=1 to n do 

read(a[i]); readln;

writeln(a[i]:3);

readln;

end. 

BT2: 

Uses crt;

var i,n,k: integer;

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

begin clrscr;

readln(n);

for i:=1 to n do 

read(a[i]); readln;

for i:=1 to n do begin

if(a[i] mod 2=0) then k:=k+a[i];

end;

writeln(k);

readln;

end.

17 tháng 3 2021

program tim_n;
uses crt;
var tong,n,i:word;
begin
  clrscr;
  n:=1;tong:=0;
  while tong<500 do
  begin
    for i:=1 to n do tong:=tong+i;
    if tong<500 then begin tong:=0;n:=n+1;end
    else n:=n-1;
  end;
  write('so n thoa man dieu kien la:',n);
  readln;
end. 

uses crt;

var i,n,t:integer;

begin

clrscr;

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

t:=0;

for i:=1 to 500 do 

begin  

t:=t+i;

if t>500 then 

begin

writeln(i);

break;

end;

end;

readln;

end.

Bài 1:

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

for i:=1 to n do 

 if i mod 6=0 then s:=s+i;

writeln(s);

readln;

end.

Bài 2: 

uses crt;

var a,b,c,ucln,i:integer;

begin

clrscr;

write('a='); readln(a);

write('b='); readln(b);

write('c='); readln(c);

while a<>b do 

  begin

if a>b then a:=a-b

else b:=b-a;

end;

ucln:=a;

while ucln<>c do 

 begin

if ucln>c then ucln:=ucln-c

else c:=c-ucln;

end;

writeln(ucln);

readln;

end.

1:

uses crt;

var i,j,t,kt:integer;

begin

clrscr;

t:=0;

for i:=1 to 100 do 

  if i>1 then 

begin

kt:=0;

for j:=2 to i-1 do 

  if i mod j=0 then kt:=1;

if kt=0 then t:=t+i;

end;

writeln(t);

readln;

end.

Câu 2: 

*Viết chương trình:

uses crt;

var n,p,t:integer;

begin

clrscr;

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

t:=0;

for p:=2 to n-1 do 

  if n mod p=0 then t:=t+p;

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

readln;

end.

30 tháng 4 2018

Program Tinh_tong;
Uses Crt;
Var i, S: Integer;
Begin
Clrscr;
S:=0; i:=1;
While S>=100 do
Begin
S:=S+i;
i:=i+1;
End;
Writeln('Ket qua',S);
Readln;
End.

6 tháng 5 2021

1. uses crt;
var a,vt:array[1..100]of integer;
n,i,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>=0;
end;
t:=0;
for i:=1 to n do
begin
if t<100 then
begin
t:=t+a[i];
dem:=dem+1;
vt[dem]:=i;
end;
end;
writeln(vt[dem]);
readln;
end.

Câu 2: 

uses crt;

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

i,n,kt:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

kt:=0;

for i:=1 to n-1 do 

if a[i]>=a[j] then kt:=1;

if kt=0 then writeln('Day la day so khong giam')

else writeln('Day khong la day so khong giam');

readln;

end.

uses crt;

var i,n,t:integer;

begin

clrscr;

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

t:=0;

for i:=1 to n do 

 if i mod 2=0 then t:=t+i;

writeln(t);

readln;

end.

uses crt;

var i,n,t:integer;

begin

clrscr;

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

t:=0;

for i:=1 to n do 

 if i mod 2=1 then t:=t+i;

writeln(t);

readln;

end.