Chỉ mình 3 câu này với ạ hoặc biết câu nào làm câu đấy cũng được Không sao đang cần nộp gấp Bài 1. Viết chương trình: - Nhập vào số nguyên N. - Tính tích N số nguyên đầu tiên và xuất kết quả ra màn hình. Bài 2. Viết chưrơng trình: - Nhập vào số nguyên N. - Tính tổng bình phương N số nguyên đầu tiên và xuất kết quả ra màn hình. Bài 3. Viết chương trình: - Nhập vào số nguyên N - Tính tổng các số chẵn nhỏ hơn N và xuất kết quả ra màn hình.

2 câu trả lời

câu 1:

uses crt;

var i,n,t:longint;

begin

clrscr;

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

t:=1;

for i:= 1 to n do t:=t*i;

writeln('Tich = ',t);

readln;

end.

câu 2

program bt;
uses crt;
var n,S,i:integer;
begin
clrscr;
writeln('hay nhap n: ');readln(n);
S:=0;
for i:=1 to n do
S:=S+(i*i);
writeln('tong binh phuong cua day so la: ',S);
readln;
end.

uses crt;
var     n,i,j:longint;
begin
        clrscrwrite('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 2<>0 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;

Câu hỏi trong lớp Xem thêm

II. Choose the word or phrase that best completes each unfinished sentence below. 6. Radioactive pollution is increasing the increased use of radioactivity. A. as B. since C. because of D. because 7. Do you think there would be less conflict in the world if all people the same language? A. spoke B. speak C. had spoken D. will speak 8. Unless you all of my questions, I can’t do anything to help you. A. answered B. answer C. would answer D. are answering 9. Singapore is famous for its …………. streets and green trees. A. cleanliness B. cleanly C. cleaning D. clean 10. If someone into the store, smile and say, “May I help you?” A. comes B. came C. come D. should come 11. It was said that the fish died a powerful toxin in the sea water. A. because of B. because C. since D. as a result 12. “Here’s my phone number”. “Thanks. I’ll give you a call if I some help tomorrow” A. will need B. need C. would need D. needed 13. is the festival celebrated? – Every year. A. When B. How often C. How D. What 14. The death rate would decrease if hygienic conditions improved. A. was B. is C. were D. had been 15. On Christmas Eve, most big cities, especially London are _______ with coloured lights across the streets and enormous Christmas trees. A. decorated B. hang C. put D. made 16. If she him, she would be very happy. A. would meet B. will meet C. met D. should meet 17. Nga is a beautiful girl; ______ , she’s kind - hearted. A. therefore B. however C. moreover D. otherwise 18. If I had enough money, I abroad to improve my English. A. will go B. would go C. went D. should have go to 19. She has read interesting book. A. a B. an C. the D. Ø 20. If it convenient, let’s go out for a drink tonight. A. be B. is C. was D. were

9 lượt xem
1 đáp án
10 giờ trước