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.
![](https://rs.olm.vn/images/avt/0.png?1311)
#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;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var a:array[1..100]of integer;
i,n:integer;
s:real;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>0;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
s:=1;
for i:=1 to n do
s:=s*a[i];
writeln(s:0:0);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long a[10],n,i,t;
int main()
{
n=0;
do
{
cin>>a[i];
}
while ((a[i]==0) or (n==10));
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++)
if (a[i]%2!=0) t=t+a[i];
cout<<t;
return 0;
}
bạn có thể code bằng c căn bản chỉ dùng printf while vs for thôi đc ko bạn
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
int n,i,t1=0,t2=0;
int main()
{
cin>>n;
for (int i=1; i<=n; i++)
{
if (i%2==0) t1+=i;
else t2+=i;
}
cout<<t1<<endl;
cout<<t2<<endl;
cout<<"hieu tuyet doi la:"<<abs(t2-t1);
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#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;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
int A,i,n;
int main()
{
cin>>n;
A=0;
For (i=1;i<=n;i++)
{
A=A+i;
}
cout<<"Tong la: "<<A;
Return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
long long i,n,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++) t=t+i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
if ((n>10) and (n<70))
{
t=0;
for (i=1; i<=n; i++)
if (i%2==0) t=t+i;
cout<<t;
}
else cout<<"Nhap lai";
return 0;
}