Những câu hỏi liên quan
Nguyễn Mai
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 4 2023 lúc 19:25

#include <bits/stdc++.h>

using namespace std;

int B[100],n,t;

{

cin>>n;

for (int i=1; i<=n; i++) cin>>B[i];

t=0;

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

if (B[i]%10==0) t+=B[i];

cout<<t<<endl;

int dem=0;

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

if ((i%2==0) && (A[i]%2!=0)) dem++;

cout<<dem<<endl;

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

if ((A[i]%2!=0) && (A[i]%3==0)) cout<<A[i];

}

Bình luận (0)
Nguyễn Mai
Xem chi tiết
Nguyễn Mai
Xem chi tiết
Bao Duong
Xem chi tiết
Thiên Nhật
Xem chi tiết
Vương Hương Giang
14 tháng 2 2022 lúc 14:26

uses crt;

var a:array[1..100]of integer;

i,n,tc,tl,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

tc:=0;

tl:=0;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then tc:=tc+a[i]

else tl:=tl+a[i];

end;

writeln('Tong cac so chan la: ',tc);

writeln('Tong cac so le la: ',tl);

t:=0;

for i:=1 to n do  

t:=t+a[i];

writeln('Tong cua day so la: ',t);

readln;

end. 

Bình luận (0)
Nguyễn Lê Phước Thịnh
14 tháng 2 2022 lúc 14:32

uses crt;

var a:array[1..1000]of integer;

i,n,dem1,dem2,t1,dem3,j,kt:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

dem1:=0;

dem2:=0;

t1:=0;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then 

begin

dem1:=dem1+1;

t1:=t1+a[i];

end;

else dem2:=dem2+1;

end;

dem3:=0;

for i:=1 to n do 

  if (a[i]>1) then 

begin

kt:=0;

for j:=2 to trunc(sqrt(a[i])) do 

  if a[i] mod j=0 then kt:=1;

if kt=0 then dem3:=dem3+1;

end;

writeln(dem1, ' ',dem2);

writeln(t1);

writeln(dem3);

readln;

end.

Bình luận (0)
Bé Kunz
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:24

Bài 1: 

uses crt;

var a:array[1..200]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 5=0 then t:=t+a[i];

writeln('Tong cac so chia het cho 5 la: ',t);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:25

Bài 2: 

uses crt;

var st:string;

d,i:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

  if st[i]=#32 then delete(st,i,1);

writeln(st);

readln;

end.

Bình luận (0)
scar titan
28 tháng 7 2021 lúc 10:11

python có ko bạn

 

Bình luận (0)
Nguyễn Thái Phương Thảo
Xem chi tiết
Thái Bảo
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 12 2020 lúc 20:08

uses crt;

var a:array[1..100]of integer;

i,n,tc,tl,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

tc:=0;

tl:=0;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then tc:=tc+a[i]

else tl:=tl+a[i];

end;

writeln('Tong cac so chan la: ',tc);

writeln('Tong cac so le la: ',tl);

t:=0;

for i:=1 to n do  

t:=t+a[i];

writeln('Tong cua day so la: ',t);

readln;

end. 

Bình luận (1)
Nguyễn Anh Quân
Xem chi tiết