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.
1:
uses crt;
const fi='ketqua.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(f1,st);
close(f1);
end.
2:
uses crt;
var a,b,c,d:integer;
{----------chuong-trinh-con-----------------------}
function min(x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
{---------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
write('d='); readln(d);
writeln(min(a,min(b,min(c,d))));
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
uses crt;
var a,b,c:string;
i,d1,d2:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
write('Nhap xau b:'); readln(b);
d1:=length(a);
d2:=length(b);
writeln('Tong do dai hai xau la: ',d1+d2);
c:=#32;
for i:=1 to d1 do
if (a[i] in ['A'..'Z']) or (a[i] in ['a'..'z']) then c:=c+a[i];
for i:=1 to d2 do
if b[i] in ['0'..'9'] then c:=c+b[i];
writeln('Xau c la: ',c);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n<0) cout<<"la so am";
else cout<<"la so duong";
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
program TinhTongPhanTuMang;
var
i, tong: integer;
m: array[1..50] of integer;
begin
for i := 1 to 50 do
begin
writeln('Nhap ptu thu ', i, ': ');
readln(m[i]);
end;
tong := 0;
for i := 1 to 50 do
begin
tong := tong + m[i];
end;
writeln('Tong cac ptu trong mang la: ', tong);
writeln('Cac ptu trong mang la:');
for i := 1 to 50 do
begin
writeln(m[i]);
end;
end.
Câu 1:
#include <bits/stdc++.h>
using namespace std;
long long i,n,k,dem,x;
int main()
{
cin>>n;
cin>>k;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x==k) dem++;
}
cout<<dem;
return 0;
}
Câu 1:
var a:array[1..100]of integer;
Câu 2:
uses crt;
var a:array[1..10]of integer;
i:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 10 do
write(a[i]:4);
readln;
end.
Câu 3:
uses crt;
var a:array[1..15]of integer;
i,n,t:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=15);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]<=100;
end;
writeln('Mang da nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln('Tong cac phan tu chia het cho 3 la: ',t);
writeln('Cac so chan o vi tri le trong day la: ');
for i:=1 to n do
if (a[i] mod 2=0) and (i mod 2=1) then write(a[i]:4);
readln;
end.
uses crt;
var t,n,m:longint;
//chuongtrinhcon
function gt(k:longint):longint;
var i,a:integer;
begin
a:=1;
for i:=1 to k do
a:=a*i;
gt:=a;
end;
//chuongtrinhchinh
begin
clrscr;
readln(n,m);
writeln(gt(n)+gt(m);
readln;
end.