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.

15 tháng 5 2020

Bài 3:

Program HOC24;

const fi='Nhapvao.txt';

var f: text;

begin

assign(f,fi);

reset(f);

close(f);

end.

15 tháng 5 2020

Bài 2:

Program HOC24;

const fo='CaDao.txt';

var f: text;

begin

assign(f,fo);

rewrite(f);

writeln(f,'Cong cha nhu nui thai son');

writeln(f,'Nghia me nhu nuoc trong nguon chay ra.');

writeln(f,'Mot long tho me kinh cha');

write(f,'Cho tron chu hieu moi la dao con');

close(f);

end.

#include <bits/stdc++.h>

using namespace std;

long long i,a[100],n;

int main()

{

freopen("songuyen.txt","r",stdin);

n=20;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

24 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[1000];

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

sort(a+1,a+n+1);

for (i=n; i>=1; i--) cout<<a[i]<<" ";

return 0;

}

20 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[10000];

int main()

{

cin>>n;

for (i=1; i<=n; i++)

cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

Bài 1: 

uses crt;

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

i,n,kt,max,x,j,tam:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

writeln('Mang ban vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

for i:=1 to n-1 do 

  for j:=i+1 to n do 

if a[i]>a[j] then 

begin

tam:=a[i];

a[i]:=a[j];

a[j]:=tam;

end;

writeln('Day tang dan la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

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

max:=0;

kt:=0;

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]<=x) then 

   begin

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

kt:=1;

end;

if kt=0 then writeln('Trong day khong co so le')

else writeln('So chan lon nhat khong vuot qua ',x,' la: ',max);

readln;

end.

18 tháng 3 2023

N = int(input("Nhập số lượng phần tử của dãy N (>50): "))

while N <= 50:

         N = int(input("Nhập lại số lượng phần tử của dãy N (>50): "))

# Nhập vào dãy số 

danh_sach = []

for i in range(N):

         danh_sach.append(int(input("Nhập số thứ %d: " % (i+1))))

# In ra dãy số vừa nhập

print("Dãy số vừa nhập:")

for i in danh_sach:

         print(i, end=' ')

# Nhập vào số nguyên x

x = int(input("nNhập vào số nguyên x: "))

# In ra các số chia hết cho x 

print("Các số chia hết cho x là:")

for i in danh_sach:

         if i % x == 0:

                  print(i, end=' ')

uses crt;

var a,b,c,p,s,am,bn,cp:real;

begin

clrscr;

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

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

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

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

begin

writeln('Day la ba canh trong mot tam giac vuong');

p:=(a+b+c)/2;

s:=sqrt(p*(p-a)*(p-b)*(p-c));

writeln('Dien tich tam giac la: ',s:4:2);

am:=sqrt(2*(sqr(b)+sqr(c))-sqr(a))/4;

bn:=sqrt(2*(sqr(a)+sqr(c))-sqr(b))/4;

cp:=sqrt(2*(sqr(a)+sqr(b))-sqr(c))/4;

writeln('Do dai duong trung tuyen ung voi canh a la: ',am:4:2);

writeln('Do dai duong trung tuyen ung voi canh b la: ',bn:4:2);

writeln('Do dai duong trung tuyen ung voi canh c la: ',cp:4:2);

end

else writeln('Day khong la ba canh trong mot tam giac');

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

for (i=1; i<=n; i++)

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

for (i=1; i<=n; i++)

if (a[i]%2==0) t1+=a[i];

cout<<t1;

return 0;

}

18 tháng 1 2021

Program HOC24;

var s: string;

tg,d,max,i: byte;

code: integer;

begin

write('Nhap xau : '); readln(s);

// cau a

for i:=1 to length(s) do if s[i] in ['a'..'z'] then write(upcase(s[i]));

//------

writeln;

//-cau b

for i:=length(s) downto 1 do if s[i] in ['0'..'9'] then write(s[i]);

//------

writeln;

//---cau c

d:=0;

for i:= 1 to length(s) do

if s[i] in ['0'..'9'] then 

begin

val(s[i],tg,code);

if tg>max then max:=tg;

d:=d+1;

end;

if d=0 then write('Khong co chu so trong day') else write('Chu so lon nhat la : ',max);

readln 

end.

uses crt;

var st,st1:string;

d,i,d1,max,x,y:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

writeln('Day cac ki tu thuong doi sang chu hoa la: ');

for i:=1 to d do 

  if st[i] in ['a'..'z'] then write(upcase(st[i]):4);

st1:='';

for i:=1 to d do 

  if st[i] in ['0'..'9'] then st1:=st1+st[i];

d1:=length(st1);

for i:=d1 downto 1 do 

  write(st1[i]:4);

writeln;

max:=0;

for i:=1 to d1 do 

  begin

val(st1[i],x,y);

if max<x then max:=x;

end;

writeln('Chu so lon nhat trong xau la: ',max);

readln;

end.