Câu trả lời được xác thực chứa thông tin chính xác và đáng tin cậy, được xác nhận hoặc trả lời bởi các chuyên gia, giáo viên hàng đầu của chúng tôi.
Bạn đang xem: Viết chương trình in ra màn hình các số chẵn

Bài `1`
Program Hotboy;
Uses crt;
var n,i:integer
Begin
Clrscr;
Write("Nhap so n tu ban phim :");
Readln(n);
For i:=1 to n do
If (i mod 2=0 ) then Write("cac so chan la",i," ");
Else
Write("cac so le la",i);
Readln
End.
Bài `2`
Program Hotboy;
Uses crt;
var n,i,S:integer
T:longint;
Begin
Clrscr;
S:=0;T:=1;
Write("Nhap so n tu ban phim :");
Readln(n);
For i:=1 to n do
S:=S+i;
For i:=1 to n do
T:=T*i;
Write("tong la",S);
Write("tich la",T);
Readln
End.
Bài `3`
Program Hotboy;
Uses crt;
var n,i,S,d:integer
Begin
Clrscr;
S:=0; d:=0;
Write("Nhap so n tu ban phim :");
Readln(n);
For i:=1 to n do
If (i mod 2=1 ) then inc(d);
S:=S+i;
Write("cac so le la",d,"tong le la",S);
Readln
End.
Bài `4`
Program Hotboy;
Uses crt;
var n,i,S,d:integer
Begin
Clrscr;
S:=0; d:=0;
Write("Nhap so n tu ban phim :");
Readln(n);
For i:=1 to n do
If (i mod 2=0) then inc(d);
S:=S+i;
Write("cac so chan la",d,"tong chan la",S);
Readln
End.
Xem thêm: Hướng Dẫn Cài Mac Os Song Song Win 10 Song Song Macos Trên Mac
Hãy giúp mọi người biết câu trả lời này thế nào?
star
starstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstarstar
3
starstarstarstarstar
1 vote
GửiHủy
Đăng nhập để hỏi chi tiết
Chưa có nhómTrả lời14
2
Cám ơn10

bài 1:
uses crt;var n,i,j:longint;begin clrscr; write("Nhap n:"); readln(n); write("so chan tu 1->n la:"); for i:=1 to n do if i mod 2=0 then write(i," "); writeln; write("so le tu 1->n la:"); for j:=1 to n do if j mod 20 then write(j," "); readln;end.
bài 2:
uses crt;var n,i,j,s,s1:longint;begin clrscr; write("Nhap n:"); readln(n); s1:=1; s:=0; write("tong cac so tu 1->n la:"); for i:=1 to n do s:=s+i; write(s); writeln; write("tich cac so tu 1->n la:"); for j:=1 to n do s1:=s1*j; write(s1); readln;end.
bài 3:
uses crt;var n,i,j,s,s1:longint;begin clrscr; write("Nhap n:"); readln(n); s1:=0; s:=0; for i:=1 to n do if i mod 20 then s:=s+i; write("tong cac so le tu 1->n la:",s); writeln; for j:=1 to n do if j mod 20 then inc(s1); write("co tat ca ",s1," so le"); readln;end.
bài 4:
uses crt;var n,i,j,s,s1:longint;begin clrscr; write("Nhap n:"); readln(n); s1:=0; s:=1; for i:=1 to n do if i mod 2=0 then s:=s*i; write("tich cac so chan tu 1->n la:",s); writeln; for j:=1 to n do if j mod 2=0 then inc(s1); write("co tat ca ",s1," so chan"); readln;end.