K
Khách

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 n;

int main()

{

cin>>n;

if (n<0) cout<<"la so am";

else cout<<"la so duong";

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long n;

int main()

{

cin>>n;

bool kt=true;

for (int i=2; i*i<=n; i++)

if (n%i==0) kt=false;

if (kt==true && n>=2) cout<<"YES";

else cout<<"NO";

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (x<0) t+=x;

}

cout<<t;

return 0;

}

Bài 1: 

uses crt;

var m,n,i,t:integer;

begin

clrscr;

write('Nhap m='); readln(m);

write('Nhap n='); readln(n);

t:=0;

for i:=m to n do 

  t:=t+i;

writeln(t);

readln;

end.

2:

uses crt;

var n:integer;

{---------------chuong-trinh-con-kiem-tra-chan-le---------------------}

function ktcl(x:integer):boolean;

begin

if x mod 2=0 then ktcl:=true

else ktcl:=false;

end;

{--------------------chuong-trinh-con-kiem-tra-duong-am-------------------}

fucntion ktda(x:integer):boolean;

begin

if x>0 then ktda:=true

else if x<0 then ktda:=false;

end;

{--------------------chuong-trinh-chinh-------------------------}

begin

clrscr;

write('Nhap n='); readln(n);

if ktcl(n)=true then writeln('Day la so chan')

else writeln('Day la so le');

if ktda(n)=true then writeln('Day la so duong')

else writeln('Day la so am');

readln;

end.

2 tháng 11 2021

Program Tin_hoc;

Uses Crt;

Var N: Integer;

Begin

        Write('Nhap so nguyen N');

        Readln(N);

        If N>0 then write(' So do la so duong ');

        If N<0 then write(' So do la so am ');

        If N=0 then write(' So do khong la so am va so duong');

        Readln;

End.

2 tháng 11 2021

Program Tin_hoc;

Uses Crt;

Var N: Integer;

Begin

        Write('Nhap so nguyen N');

        Readln(N);

        If N>0 then write(' So do la so duong ');

        If N<0 then write(' So do la so am ');

        If N=0 then write(' So do khong la so am va so duong');

        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.

Làm bằng pascal thì những bài như thế này thì test lớn chạy không nổi đâu bạn

#include <bits/stdc++.h>

using namespace std;

long long n,a,b;

int main()

{

cin>>n;

a=1;

while (pow(a,3)<=n) 

{

a++;

}

if (pow(a,3)==n) cout<<"YES";

else cout<<"NO";

cout<<endl;

b=1;

while (pow(5,b)<=n) do b++;

if (pow(5,b)==n) cout<<"YES";

else cout<<"NO";

cout<<endl<<pow(n,n)%7;

return 0;

}

24 tháng 2 2022

mik chỉ làm mỗi câu là một bài thôi bạn

18 tháng 7 2023

THAM KHẢO!

def is_prime(n):

 if n <= 1:

  return "KHÔNG"# Trường hợp n <= 1 không phải số nguyên tố

 elif n <= 3:

  return "CÓ"# Trường hợp n = 2 hoặc n = 3 là số nguyên tố

 elif n % 2 == 0:

  return "KHÔNG"# Trường hợp n chẵn lớn hơn