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;
int main()
{
long long n;
cin>>n;
if (n%2==0) cout<<n<<" la so chan"<<endl;
else cout<<n<<" la so le"<<endl;
if (n<0) cout<<n<<" la so am";
else cout<<n<<" la so khong am";
return 0;
}
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
long t=0; int i,j;
for (i=2; i<=n; i++){
int c=0;
for (j=2; j<i; j++)
if (i%j==0) c++;
if (c==0) t=t+i;
}
printf("%d",t);
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
dem=0;
for (i=1; i<=n; i++)
if (a[i]%2==0 && a[i]<0) dem++;
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem,t,j,t1;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
{
t=0;
for (j=1; j<=a[i]-1; j++)
if (a[i]%j==0) t+=j;
if (t==a[i]) dem++;
}
cout<<dem<<endl;
t1=0;
for (i=1; i<=n; i++)
if (a[i]%2==0) t1+=a[i];
cout<<t1;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem,t,j,t1;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
{
t=0;
for (j=1; j<=a[i]-1; j++)
if (a[i]%j==0) t+=j;
if (t==a[i]) dem++;
}
cout<<dem<<endl;
t1=0;
for (i=1; i<=n; i++)
if (a[i]%2==0) t1+=a[i];
cout<<t1;
return 0;
}
1:
#include <bits/stdc++.h>
using namespace std;
long long n,i,s;
int main()
{
cin>>n;
s=0;
for (i=1; i<=n; i++)
s=s+i*i;
cout<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,s;
int main()
{
cin>>n;
s=0;
for (i=1; i<=n; i++) s=s+i*i;
cout<<s;
return 0;
}
Var s,i,n:longint;
Begin
Write('Nhap so luong so n = ');readln(n);
For i:=1 to n do
s:=s+i*i;
Write('Tong la ',s);
Readln;
End.
1:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a+b;
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
double s,r;
int main()
{
cin>>r;
s=r*r*pi;
cout<<fixed<<setprecision(2)<<s;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
freopen("fibonacci.inp","r",stdin);
freopen("fibonacci.out","w",stdout);
cin>>n;
double c5=sqrt(5);
cout<<fixed<<setprecision(0)<<((1/c5)*(pow((1+c5)/2,n)-pow((1-c5)/2,n)));
return 0;
}