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.
#include <bits/stdc++.h>
using namespace std;
long long a,b,t,i;
int main()
{
cin>>a>>b;
t=0;
for (i=a; i<=b; i++)
if (i%3==0) t=t+i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,k;
cin>>a>>b>>k;
for (int i=a; i<=b; i++)
if (i%k==0) cout<<i<<" ";
return 0;
}
uses crt;
var a:array[1..10]of integer;
i,n,dem:integer;
begin
clrscr;
for i:=1 to 10 do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>0;
end;
writeln('Day so vua nhap la: ');
for i:=1 to 10 do
write(a[i]:4);
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln;
writeln('So luong so chan la: ',dem);
readln;
end.
Program Hoc24;
var a: array[1..32000] of integer;
d,i,n,x: integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
write('Nhap so can tim: '); readln(x);
d:=0;
for i:=1 to n do if a[i]=x then d:=d+1;
if d>0 then write('Co so can tim trong day ban dau') else write('Khong co so can tim trong day ban dau');
readln
end.
uses crt;
var a:array[1..100]of integer;
n,i,x,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap so can tim: '); readln(x);
kt:=0;
for i:=1 to n do
if a[i]=x then kt:=1;
if kt=0 then writeln(x,' khong co trong day')
else writeln(x,' co trong day');
readln;
end.
Câu 1:
var a:array[1..100]of integer;
Câu 2:
uses crt;
var a:array[1..10]of integer;
i:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 10 do
write(a[i]:4);
readln;
end.
Câu 3:
uses crt;
var a:array[1..15]of integer;
i,n,t:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (0<n) and (n<=15);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]<=100;
end;
writeln('Mang da nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln('Tong cac phan tu chia het cho 3 la: ',t);
writeln('Cac so chan o vi tri le trong day la: ');
for i:=1 to n do
if (a[i] mod 2=0) and (i mod 2=1) then write(a[i]:4);
readln;
end.
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Nhap so a="; cin>>a;
cout<<"Nhap so b="; cin>>b;
cout<<a%b;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,dem1,dem2,t1,t2,sa,sd,vt1,vt2:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
dem1:=0;
t1:=0;
dem2:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then begin inc(dem1); t1:=t1+a[i]; end;
if a[i]<0 then begin inc(dem2); t2:=t2+a[i]; end;
end;
writeln(dem1);
writeln(dem2);
writeln(t1);
writeln(t2);
for i:=1 to n do
if a[i]>0 then
begin
sd:=a[i];
vt1:=i;
break;
end;
if (dem1=0) then writeln('Khong co so duong trong day')
else writeln('So duong dau tien la: ',sd,' vi tri la: ',vt1);
for i:=1 to n do
if a[i]<0 then
begin
sa:=a[i];
vt2:=i;
break;
end;
if (dem2=0) then writeln('Khong co so am trong day')
else writeln('So am dau tien la: ',sa,' vi tri la: ',vt2);
readln;
end.
Var a,b,ta,tb,r,ucln,bcnn:integer;
Begin
Write('a = ');readln(a);
Write('b = ');readln(b);
ta:=a;
tb:=b;
Repeat
r:=ta mod tb;
ta:=tb;
tb:=r;
Until r = 0;
ucln:=ta;
bcnn:=a*b div ucln;
Writeln('UCLN(',a,'; ',b,') la ',ucln);
Write('BCNN(',a,'; ',b,' la ',bcnn);
Readln
End.
Var a,b:Integer;
Begin
Clrscr;
Write(' Nhap a, b');
Read(a,b);
End.
Đề thiếu rồi bạn