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:integer;
begin
write('Nhap n: '); readln(n);
if (n mod 3 =0) then
write(n,' chia het cho 3')
else
write(m,' k chia het cho 3');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1;i<=n; i++)
{
cin>>x;
if (x%3==0) t+=x;
}
cout<<t;
return 0;
}
1. uses crt;
var a,vt:array[1..100]of integer;
n,i,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>=0;
end;
t:=0;
for i:=1 to n do
begin
if t<100 then
begin
t:=t+a[i];
dem:=dem+1;
vt[dem]:=i;
end;
end;
writeln(vt[dem]);
readln;
end.
Câu 2:
uses crt;
var a:array[1..30]of integer;
i,n,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
kt:=0;
for i:=1 to n-1 do
if a[i]>=a[j] then kt:=1;
if kt=0 then writeln('Day la day so khong giam')
else writeln('Day khong la day so khong giam');
readln;
end.
program TongN;
var
n, i, tong: integer;
begin
tong := 0;
writeln('Nhap so nguyen duong N: ');
readln(n);
i := 0;
while i < n do
begin
i := i + 1;
tong := tong + i;
end;
writeln('Tong cac so tu 1 den ', n, ' la ', tong);
readln;
end.
Bài 2:
uses crt;
var a:array[1..30]of integer;
i,n,kt:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
kt:=0;
for i:=1 to n-1 do
if a[i]>a[i+1] then kt:=1;
if kt=0 then write('Day so khong giam')
else writeln('Day so lon xon');
readln;
end.
Tham khảo!
program b1;
uses crt;
var a:array[1..100] of integer; i,n,max,min:integer; s:longint;
begin
clrscr;
write('Nhap vao so nguyen n:');
readln(n);
for i:=1 to n do
readln(a[i]);
min:=a[1];
max:=a[1];
for i:=2 to n do
begin
if(a[i]<min) then min:=a[i];
if(a[i]>max) then max:=a[i];
end;
for i:=1 to n do
s:=max+min;
write('Tong cua so lon va so be=',s);
readln;
end.
Hỏi nhìu quá sốc
program tim_tong;
uses crt;
var x,i,tong:longint;
begin
clrscr;
tong:=0;i:=1;
while tong<=3500 do
begin
write('x',i,'=');readln(x);
tong:=tong+x;
i:=i+1;
end;
write('tong cac so tren la:',tong);
readln;
end.