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.

12 tháng 12 2019

Hỏi đáp Tin học

12 tháng 12 2019

Hỏi đáp Tin học

12 tháng 12 2019

uses crt;

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

i,n,t,dem:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

{------------------------------xu-ly---------------------------}

dem:=0;

t:=0;

for i:=1 to n do

if a[i] mod 3=0 then

begin

inc(dem);

t:=t+a[i];

end;

writeln('so phan tu la boi cua 3 trong day nay la: ',dem);

writeln('tong cua cac phan tu la boi cua 3 trong day nay la: ',t);

readln;

end.

11 tháng 12 2019

uses crt;
var m,n,dem,i:integer;
begin
clrscr;
write('nhap m='); readln(m);
write('nhap n='); readln(n);
if (m>0) and (n>0) then
begin
if m<n then
begin
dem:=0;
for i:=m to n do
if (i mod 2=1) then
begin
if (i mod 3<>0) or (i mod 5<>0) then inc(dem);
end;
writeln('so luong cac so le khong chia het cho 3 hoac 5 trong pham vi tu ',m,' toi ',n,' la: ',dem);
end
else writeln('vui long nhap m lon hon n');
end
else writeln('vui long nhap so lon hon 0');
readln;
end.

11 tháng 12 2019

inc là gì vậy bạn

10 tháng 12 2019

uses crt;

var a,b,c:integer;

begin

clrscr;

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

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

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

if (a>0) and (b>0) and (c>0) then

begin

if (a+b>c) and (a+c>b) and (b+c>a) then

begin

if (a=b) and (b=c) then writeln('day la tam giac deu')

else writeln('day khong la tam giac deu');

end

else writeln('day khong la 3 canh trong mot tam giac');

end

else writeln('vui long nhap so lon hon 0');

readln;

end.

uses crt;

var st,st1:string;

d,d1:integer;

begin

clrscr;

write('nhap xau thu 1:'); readln(st);

write('nhap xau thu 2:'); readln(st1);

d:=length(st);

d1:=length(st1);

writeln('tong do dai hai xau la: ',d+d1);

readln;

end.

9 tháng 12 2019

program ho_tro;

uses crt;

var a,b,c: integer;

begin

clrscr;

writeln(' nhap ba goc:'); readln(a,b,c);

if (a+b+c)=180 then writeln(' la 3 goc cua tam giac:')

else writeln(' k phai 3 goc cua tam giac:');

readln;

end.

uses crt;
var a,b,c,kt:integer;
begin
clrscr;
write('nhap a='); readln(a);
write('nhap b='); readln(b);
write('nhap c='); readln(c);
if (a+b>c) and (a+c>b) and (b+c>a) then
begin
write('day la tam giac ');
kt:=0;
if ((a=b)and(a<>c)and(b<>c)) or ((b=c)and(b<>a)and(b<>c)) or ((a=c)and(a<>b)and(c<>b)) then kt:=1;
if (a=b) and (b=c) then kt:=2;
if (sqr(a)=sqr(b)+sqr(c)) or (sqr(b)=sqr(a)+sqr(c)) or (sqr(c)=sqr(a)+sqr(b)) then kt:=3;
if kt=0 then write('thuong');
if kt=1 then write('can');
if kt=2 then write('deu');
if kt=3 then write('vuong');
end
else writeln('day khong phai la tam giac');
readln;
end.

1:

Program GIAI_PHUONG_TRINH_BACII;
Uses CRT;
Var a,b,c,D,x,x1,x2: real;
Begin
Clrscr;
Writeln('GIAI PHUONG TRINH BAC II: ');
Writeln('-------------------------------------------');
Write('Nhap he so a='); readln(a);
Write('Nhap he so b='); readln(b);
Write('Nhap he so c='); readln(c);
If a=0 then
If b=0 then
If c=0 then
Writeln('Phuong trinh co vo so nghiem')
Else Writeln('Phuong trinh vo nghiem')
Else Writeln('Phuong trinh co mot nghiem: x=',-c/b: 4: 2)
Else
Begin
D:=b*b-4*a*c;
If D=0 then Writeln('Phuong trinh co nghiem kep: x=',-b/(2*a): 4: 2)
Else
If D<0 then Writeln('Phuong trinh vo nghiem')
Else
Begin
x1:=(-b-sqrt(D))/(2*a);
x2:=(-b+sqrt(D))/(2*a);
Writeln('Phuong trinh co 2 nghiem la x1= ',x1:4:2 ,' va x2= ',x2:4:2);
End;
End;
Readln;

End.

2:

uses crt;
var a,b,c,max:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
writeln('so lon nhat la: ',max);
readln;
end.

3:

uses crt;
var a,b,c,kt:integer;
begin
clrscr;
write('nhap a='); readln(a);
write('nhap b='); readln(b);
write('nhap c='); readln(c);
if (a+b>c) and (a+c>b) and (b+c>a) then
begin
write('day la tam giac ');
kt:=0;
if ((a=b)and(a<>c)and(b<>c)) or ((b=c)and(b<>a)and(b<>c)) or ((a=c)and(a<>b)and(c<>b)) then kt:=1;
if (a=b) and (b=c) then kt:=2;
if (sqr(a)=sqr(b)+sqr(c)) or (sqr(b)=sqr(a)+sqr(c)) or (sqr(c)=sqr(a)+sqr(b)) then kt:=3;
if kt=0 then write('thuong');
if kt=1 then write('can');
if kt=2 then write('deu');
if kt=3 then write('vuong');
end
else writeln('day khong phai la tam giac');
readln;
end.

4:

uses crt;
var a:integer;
begin
clrscr;
write('a='); readln(a);
if a mod 2=0 then writeln(a,' la so chan')
else writeln(a,' la so le');
if a>0 then writeln(a,' la so duong')
else if a<0 then writeln(a,' la so am')
else writeln(a,' khong la so am cung khong la so duong');
readln;
end.

8 tháng 12 2019

Mình cảm ơn ạ

8 tháng 12 2019

program hotrotinhoc;

var i,n: byte;

t: longint;

a: array[1..150] of integer;

begin

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

t:=0;

for i:=1 to n do

begin

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

if (a[i] mod 3=0) and (a[i] mod 5=0) then t:=t+a[i];

end;

writeln('Cac phan tu le trong mang : ');

for i:=1 to n do if a[i] mod 2=1 then write(a[i],' ');

writeln;

write('Tong phan tu chia het cho 3 va 5 la :',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;
{-------------------------xu-ly------------------------}
writeln('cac so le trong day la: ');
for i:=1 to n do
if a[i] mod 2=1 then write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if (a[i] mod 3=0) and (a[i] mod 5=0) then t:=t+a[i];
writeln('tong cac phan tu chia het cho 3 va chia het cho 5 la: ',t);
readln;
end.

9 tháng 12 2019

Hỏi đáp Tin học