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.
a) n mod 3=0;
b) m mod 7<>0;
c) y<=100;
d) (a+b>c) and (b+c>a) and (a+c>b);
e) ((a>0) and (b>0)) or ((a<0) and (b<0));
f) a/b=3/4;
g) ((a>5) and (b+c=10)) or ((a<=5) and (b+c=-20));
h) (m=1) or (m=3) or (m=5) or (m=7) or (m=8);
Uses Crt;
Var A : array [1..1000] of longint;
n, m, d, t, i, S, k : longint;
Begin
//Phan A
Clrscr;
Writeln(' Phan A ');
Write(' Ban hay nhap 1 so n bat ky: ');
Readln(n);
Write(' Cac so chia het cho ba tu 1 den ',n,' la: ');
For i:=1 to n do
If (i mod 3) = 0 then Write(' ',i);
//Phan B
Writeln;
Writeln(' Phan B ');
Write(' Ban hay nhap 1 so m bat ky: ');
Readln(m);
For i:=1 to m do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
S:= S+A[i];
End;
Write(' Tong cua day so tren la: ',S);
//Phan C
Writeln;
Writeln(' Phan C ');
Write(' Ban hay nhap 1 so d bat ky: ');
Readln(d);
Write(' Ban hay nhap so K: ');
Readln(k);
For i:=1 to n do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
If ((A[i] div k)=1)then t:=t+1;
End;
Write(' Co tat ca ',t,' so giong ',k);
Readln;
End.
#include <iostream>
int main() {
int n;
std::cout << "Nhap so tu nhien n: ";
std::cin >> n;
int sum = 0;
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
sum += i;
}
}
std::cout << "Tong cac so tu nhien nho hon hoac bang " << n << " ma chia het cho 3 la: " << sum << std::endl;
return 0;
}
```c++
#include <iostream>
using namespace std;
int main() {
int n, sum = 0;
cout << "Nhap so nguyen duong n: ";
cin >> n;
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
sum += i;
}
}
cout << "Tong cac so tu nhien nho hon hoac bang " << n << " ma chia het cho 3 la: " << sum;
return 0;
}
```
Uses crt;
var n,i,x,u: integer;
begin clrscr;
readln(n);
for i:=1 to n do begin
readln(x);
u:=u+x;
end;
writeln(u);
readln;
end.
program TongCacSoNguyen;
var
N, i, soNguyen, tong: integer;
begin
// Nhập số lượng N
write('Nhap so luong N: ');
readln(N);
// Khởi tạo tổng
tong := 0;
// Nhập và tính tổng các số nguyên
for i := 1 to N do
begin
write('Nhap so nguyen thu ', i, ': ');
readln(soNguyen);
tong := tong + soNguyen;
end;
// In ra màn hình tổng
writeln('Tong cua cac so nguyen la: ', tong);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t1,t2,t3:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t1:=0;
for i:=1 to n do
if a[i]<0 then t1:=t1+a[i];
writeln('Tong cac so am la: ',t1);
t2:=0;
for i:=1 to n do
if a[i] mod 2=0 then t2:=t2+a[i];
writeln('Tong cac so chia het cho 2 la: ',t2);
t3:=0;
for i:=1 to n do
if (a[i]>0) and (a[i] mod 3=0) then t3:=t3+a[i];
writeln('Tong cac so duong chia het cho 3 la: ',t3);
readln;
end.
program hotrotinhoc;
var n,i.d: integer;
t: longint;
begin
readln(n);
t:=0; d:=0;
for i:=1 to n do
if i mod 3=0 then t:=t+i;
writeln('Tong cac so chia het cho 3 tu 1 den n la:',t);
for i:=1 to n do
if i mod 3=0 then inc(d);
write('Co ',d,' so chia het cho 3 tu 1 den N');
readln
end.
Bạn tham khảo nhé!
uses crt;
var a,b,t,i:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
t:=0;
for i:=a to b do
if i mod 3=0 then t:=t+i;
writeln(t);
readln;
end.
uses crt;
var n,i,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=1 to n do
if i mod 3=0 then
begin
write(i:4);
t:=t+i;
end;
writeln;
writeln('Tong cac so chia het cho 3 la: ',t);
readln;
end.
uses crt;
var i,n,d:longint;
begin
d:=0;
writeln('nhapn=');read(n);
for i:=1 to n do
begin
if i mod 3=0 then write(i,' ');
if i mod 3=0 then d:=d+i;
end;
writeln('tong=',d);
readln;
end;
Program Bai1;
Uses Crt;
Var a, b : integer;
Program Baitest;
Uses Crt;
Var a, b, i: integer;
Begin
Clrscr;
Write(' Ban hay nhap 1 so a bat ky: ');
Readln(a);
Write(' Ban hay nhap 1 so b bat ky: ');
Readln(b);
Write(' Cac so chia het cho 2 va 3 la: ');
Writeln;
For a:=1 to b do
if (((a+b) mod 2) = 0) and (((a+b) mod 3) = 0) then Write(' ',a+b);
Readln
End.