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.
program bai1;
var
begin
write('Ten cua ban la ');readln(ten);
write('Nam hien tai la ');readln(nht);
write('Nhap nam sinh ');readln(ns);
write('Ban hoc lop ');readln(lop);
tuoi:=nht-ns;
writeln('Ten cua ban la ',tuoi);
readln
end.
Câu 4:
fucntion tong(x:integer):integer;
var st:string;
d,i,n,y,t:integer;
begin
str(x,st);
d:=length(st);
t:=0;
for i:=1 to d do
begin
val(st[i],n,y);
t:=t+n;
end;
tong:=t;
end;
Câu 2:
const fi='bai2.inp';
fo='bai2.out';
var f1,f2:text;
a:array[1..100]of integer;
n,i,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.
1/
program uoc;
uses crt;
var n,i,dem,x:word;
a:array[1..20] of longint;
begin
clrscr;
write('nhap so phan tu cua day:') ;readln(n);
while n>20 do
begin
write('nhap lai so phan tu thoa man toi da la 20 phan tu:');
readln(n);
end;
writeln('nhap cac phan tu cua mang:');
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
write('nhap so nguyen x:'); readln(x);
dem:=0;
for i:=1 to n do
if x mod a[i] =0 then
begin
dem:=dem+1;
writeln(a[i],' la uoc cua ',x);
end;
if dem=0 then writeln('khong co phan tu la uoc cua ',x)
else write('co ',dem,' phan tu la uoc cua ',x);
readln;
end.
uses crt;
var a,b,c:integer;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
until (a>0) and (b>0) and (c>0);
if (a+b>c) and (a+c>b) and (b+c>a) then writeln('Day la ba canh trong mot tam giac')
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
1:
uses crt;
const fi='songuyen.doc';
var i:integer;
f1:text;
begin
clrscr;
assign(f1,fi); rewrite(f1);
for i:=1 to 10 do write(f1,i:4);
close(f1);
readln;
end.
program dung;
uses crt;
var x: integer'
t: real;
begin
clrscr;
write('x= '); readln(x);
t:=(5*x-7)+sqrt(3*x*x+7*x-6);
write('Dien tich la: ',s:1:2);
write('Ket qua: ',t);
readln;
end.