HOC24
Lớp học
Môn học
Chủ đề / Chương
Bài học
Bài 1:
Uses crt;
var i,n,j:integer;
a,b,c:array[1..100000] of integer;
Begin
clrscr;
readln(n);
for i:= 1 to n do readln(a[i]);
for i:= 1 to n do readln(b[i]);
j:=0;
for i:= 1 to n do
inc(j);
c[j] := a[i];
c[j] := b[i];
end;
for i:= 1 to j do write(c[i],' ');
readln;
end.
Program Tin_hoc;
uses crt;
var n,i,dem:integer;
a:array[1..10000] of integer;
dem:=0;
readln(a[i]);
if a[i] mod 2 = 0 then inc(dem);
writeln('Day so co ',dem,' so chan');
Có thể bỏ uoc:=0; tam:=0 ở dòng thứ 5 nha
Uses crt;var i,n,uoc,j,tam:longint;Beginclrscr;readln(n);uoc:=0;tam:=0;for i:= 1 to n do if n mod i = 0 then inc(uoc);if uoc = 2 then write(n,' la so nguyen to') else for i:= 2 to n do if n mod i = 0 then begin tam:=0; for j:= 1 to i do if i mod j = 0 then inc(tam); if tam = 2 then write(i,' '); end;readln;end.
Có chỗ nào sai thì bảo mình
var i,n,dem:integer;
write('Nhap n: ');readln(n);
begin
if i mod 2 = 1 then
write(i,' ');
inc(dem);
if dem mod 15 = 0 then writeln;
Readln;
End.
var i,n:longint;
S,A:real;
Readln(A);
S:=0;n:=0;
while S<=A do
S:=0;
inc(n);
for i:= 1 to n do S:=S+1/i;
Writeln(n);
var s:string;
i,dem:integer;
Write('Nhap xau: ');readln(s);
for i:= 1 to length(s) do if (s[i]='a') or (s[i]='e') or (s[i]='i') or (s[i]='o') or (s[i]='u') or (s[i]='y') then inc(dem);
Writeln('Xau vua nhap co ',dem,' nguyen am');
Uses crt;var f1,f2:text; i,n,tong,tongchan,dem:integer; tb:real;Begin clrscr; Assign(f1,'DAYSO.txt'); Assign(f2,'KETQUA.txt'); reset(f1);dem:=0;tong:=0;tongchan:=0; While Not EOF(f1) do Begin read(f1,i); inc(tong,i); If i mod 2 = 0 then begin inc(dem); inc(tongchan,i); end; End; tb:=tongchan/dem; close(f1); rewrite(f2); writeln(f2,tong); writeln(f2,tongchan); writeln(f2,tb:0:2); close(f2); write(tong); readln;End.
var i,a,b,tam:integer;
Write('Nhap 2 so a,b: ');readln((a,b);
If a>b then
a:=a*2;
b:=b*2;
End
else if a<b
tam:=a;
a:=b;
b:=tam;
End;