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.
Uses crt;
Var n,i,a : integer;
Begin
a:=0;
Write('nhap n'); readln(n);
For i:=1 to n do
If (i mod 3= 0) then inc(a);
Writeln('so so chia het cho 3 la',a);
Readln
End.
program oken;
uses crt;
var n,i,dem:integer;
begin
clrscr;
write('nhap so n: '); readln(n);
for i:=1 to n do
if (i mod 3=0) then
begin
write(i,' ');
dem:=dem+1;
end;
writeln;
if dem=0 then
writeln('tu 1 den ',n,' khong co so chia het cho 3.')
else
writeln('co ',dem,' so chia het cho 3.');
readln;
end.
Uses crt;
Var n,i,a : integer;
Begin
a:=0;
Write('nhap n'); readln(n);
For i:=1 to n do
If (i mod 3= 0) then inc(a);
Writeln('so so chia het cho 3 la',a);
Readln
End.
program oken;
uses crt;
var n,i,dem:integer;
begin
clrscr;
write('nhap so n: '); readln(n);
for i:=1 to n do
if (i mod 3=0) then
begin
write(i,' ');
dem:=dem+1;
end;
writeln;
if dem=0 then
writeln('tu 1 den ',n,' khong co so chia het cho 3.')
else
writeln('co ',dem,' so chia het cho 3.');
readln;
end.
Câu 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
if n<2 then writeln(n,' khong la so nguyen to')
else begin
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,x,t;
int main()
{
cin>>n;
t=0;
while (n>0)
{
x=n%10;
t=t+x;
n/=10;
}
cout<<t;
return 0;
}
Var t,n:integer;
begin
write('nhap n = ');readln(n);
while n div 10 <> 0 do
begin
t:=t+(n mod 10);
n:=n div 10;
end;
write('Tong cac chu so cua ',n,' la ',t);
readln;
end.
var a:array[1..32000] of integer;
i,n,T,S:integer;
begin
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
T:=0;
for i:=1 to n do if a[i] mod 2=0 then T:=T+a[i];
writeln('tong cac so chan la:',T);
S:=0;
for i:=1 to n do if a[i]<0 then S:=S+a[i];
writeln('tong cac so am la:',S);
readln
end.
khổ thân