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.
var n,i,kq:integer;
a:array[1..100] of integer;
begin
write(' n = ');readln(n);
for i:=1 to n do
if (i mod 3 = 0) then
begin
i:=kq+i;
end;
write(' tong cac so chia het cho 3 la ',kq);
readln;
end.
Bài 1: mình làm theo free pascal nhé
Uses crt;
Var i,n,tong:integer;
Begin
CLRSCR;
Writeln('Moi nhap n de tinh tong') Readln(n);
For i:=1 to n do
tong:=tong+i;
Writeln('Tong cua day tren la',tong);
Readln;
End.
Câu 2: mình làm theo Free pascal nhé
Bài Làm:
Uses crt;
Var n,i,tong:integer;
a ARRAY [1..100] of integer;
Begin
CLRSCR;
Writeln('Moi nhap do dai cua mang'); Readln(n);
For i:=1 to n do
Begin
Writeln('a[',i,']');
Readln(a[i]);
End;
tong:=0;
For i:=1 to n do
tong:=tong+a[i];
Writeln('Tong cua day tren la ',tong);
Readln;
End.
b: uses crt;
begin
clrscr;
writeln(sqr(15+5)*sqr(6+4)*(6+4));
readln;
end.
uses crt;
var s,i:integer;
begin
clrscr;
s:=0;
for i:=1 to 100 do s:=s+i;
writeln(s);
readln;
end.
#include <iostream>
using namespace std;
int main () {
int tong = 0;
for (int i = 1 ; i <= 100; i++) tong = tong + i;
cout << " Tong S = " << tong;
return 0;
}
Chạy chương trìnhTong S = 5050