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[10],n=10,i,t1,t2;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t1=0;
t2=0;
for (i=1; i<=n; i++)
{
if (a[i]%2==0) t1+=a[i];
else t2+=a[i];
}
cout<<t1<<" "<<t2;
return 0;
}
6:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],i,dem=0;
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1;i<=n; i++)
if (A[i]%2!=0) dem++;
cout<<dem;
return 0;
}
5:
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,nn=1e6,A[1000];
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1; i<=n; i++)
nn=min(nn,A[i]);
for (int i=1; i<=n; i++)
if (nn==A[i]) cout<<i<<" ";
return 0;
}
uses crt;
var a:array[1..10]of integer;
i,t:integer;
begin
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to 10 do
t:=t+a[i];
writeln('Tong cua day la: ',t);
writeln('Trung binh cong cua day la: ',t/n:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10],i,dem;
int main()
{
for (i=1; i<=10; i++) cin>>a[i];
for (i=1; i<=10; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=10; i++) if (a[i]%3==0) dem++;
cout<<dem;
return 0;
}
Câu 1:
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
int t=0;
while (n>0)
{
int x=n%10;
t=t+x;
n=n/10;
}
cout<<t;
return 0;
}
uses crt;
var a:array[1..10]of integer;
i,n,t:integer;
begin
clrscr;
n:=10;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t/n:4:2);
readln;
end.
uses crt;
const fi='kq.txt';
var a:array[1..10]of integer;
i,n:integer;
f1:text;
begin
clrscr;
n:=10;
for i:=1 to n do readln(a[i]);
assign(f1,fi); rewrite(f1);
for i:=1 to n do
begin
if (n%5<>0) then write(f1,a[i]:4);
else writeln(f1);
end;
close(f1);
readln;
end.
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long a[10],i;
bool kt;
int main()
{
for (i=1; i<=10; i++) cin>>a[i];
kt=true;
for (i=1; i<=9; i++) if (a[i]>a[i+1]) kt=false;
if (kt==true) cout<<"YES";
else cout<<"NO";
return 0;
}