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[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.
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;
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;
}
Bài 3:
#include <bits/stdc++.h>
using namespace std;
long long x,n,i;
int main()
{
cin>>n;
for (i=0; i<=n; i++)
{
x=int(sqrt(i));
if (x*x==i) cout<<i<<" ";
}
return 0;
return 0;
}