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.
program tim_so_nguyen;
uses crt;
var i,N:integer;
begin
clrscr;
write('nhap so nguyen:');
readln(N);
if N <= 2 then write(N,' khong phai la so nguyen to')
else
begin
i:=2;
while ( N mod i <> 0 ) do i:=i+1;
if i=N then write(N,' la so nguyen to')
else write(N,' khong phai la so nguyen to');
end;
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,kt;
cin>>n;
for (int i=2; i<=n; i++)
{
kt=0;
for (int j=2; j*j<=i; j++)
if (i%j==0) kt=1;
if (kt==0) cout<<i<<" ";
}
}
uses crt;
var n,i,t,s:integer;
begin
clrscr;
repeat
readln(n);
until n<>0;
t:=0;
for i:=1 to n do if i mod 2=0 then t:=t+i;
writeln(t);
s:=1;
for i:=1 to n do
if i mod 2=1 then s:=s*i;
writeln(s);
readln;
end.
program SoHoanHao;
uses crt;
var
i, j, n, s: integer;
begin
clrscr;
write('Nhap n: ');
readln(n);
for i := 1 to n do
begin
s := 0;
for j := 1 to i - 1 do
begin
if i mod j = 0 then
s := s + j;
end;
if s = i then
writeln(i);
end;
readln;
end.
uses crt;
var i,n,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 2=1 then s:=s+i;
writeln(s);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%3==0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) if (i%3==0) cout<<i<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%2==0) t+=i;
cout<<t;
return 0;
}
program ct1;
uses crt;
var n,i:integer;
begin
clrscr;
write('nhap n: '); readln(n);
for i:=1 to n do
write(i,' ');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n,x,a[100];
int main()
{
cin>>n;
for (i=1; i<=n; i++)
{
cin>>a[i];
}
for (i=1;i<=n; i++)
cout<<a[i]<<" ";
return 0;
}