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 a,b;

int main()

{

cin>>a>>b;

if ((a%2==0) and (b%2==0)) cout<<"2 so chan";

else if ((a%2==0) and (b%2!=0)) or ((a%2!=0) and (b%2==0)) cout<<"1 so chan";

else cout<<"Hai so le";

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long x,i,n,dem;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

if (x<0) dem++;

}

cout<<dem;

return 0;

}

4 tháng 11 2021

Câu 1: Liệt kê:

- B1: Nhập số nguyên dương N.

- B2: Nếu N = 1 thì thông báo N không là số nguyên tố rồi kết thúc.

- B3: Nếu N < 4 thì thông báo N là số nguyên tố rồi kết thúc.

- B4: i ← 2

- B5: Nếu N>[\(\sqrt{N}\)​](*) thì thông báo N là số nguyên tố rồi kết thúc.

- B6: Nếu N chia hết cho i thì thông báo N là số không nguyên tố rồi kết thúc.

- B7: i ←i+1 rồi quay lại bước 5

Sơ đồ khối:

Câu 2:

N5162
Kết quảLà số nguyên tốKhông là số nguyên tố

 

 

#include <bits/stdc++.h>

using namespace std;

long long x,i,n,dem;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

if (x<0) dem++;

}

cout<<dem;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

double a,b;

int main()

{

cin>>a>>b;

cout<<fixed<<setprecision(2)<<a+b<<endl;

cout<<fixed<<setprecision(2)<<a-b<<endl;

cout<<fixed<<setprecision(2)<<a*b<<endl;

cout<<fixed<<setprecision(2)<<a/b;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long x,i,n,dem;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

if (x<0) dem++;

}

cout<<dem;

return 0;

}

Câu 1: 

a: \(138_{10}=\text{10001010}_2\)

b: \(11001110_2=206_{10}\)

#include <bits/stdc++.h>

using namespace std;

long long x,i,n,t,k;

int main()

{

cin>>n>>k;

t=0;

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

{

cin>>x;

if (x>k) t=t+x;

}

cout<<t;

return 0;

}