Những câu hỏi liên quan
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)
Hoàng lĩnh
Xem chi tiết
Kiều Vũ Linh
20 tháng 3 2023 lúc 12:20

Var i,n:integer;

s:longint;

Begin

Write('n = ');readln(n);

For i:=1 to n-1 do

If (i mod 2 = 0) and (i mod 3 = 0) then

s:=s + i;

Write('Tong la ',s);

Readln;

End.

Bình luận (0)
Tuoi tom May
Xem chi tiết
Phía sau một cô gái
4 tháng 5 2023 lúc 20:40

program TimMinMaxTrungBinh;

var

      N, i, max, min, sum: integer;

      a: array[1..50] of integer;

      TB, minTB, maxTB: real;

begin

      writeln('Nhap so nguyen duong N:');

      readln(N);

      sum := 0;

      for i := 1 to N do

      begin

            write('Nhap so thu ', i, ': ');

            readln(a[i]);

            sum := sum + a[i];

      end;

      max := a[1];

      min := a[1];

      for i := 2 to N do

      begin

            if a[i] > max then

                  max := a[i];

            if a[i] < min then

                  min := a[i];

      end;

      TB := sum / N;

      minTB := TB;

      maxTB := TB;

      for i := 1 to N do

      begin

            if (a[i] < TB) and (a[i] < minTB) then

                  minTB := a[i];

            if (a[i] > TB) and (a[i] > maxTB) then

                  maxTB := a[i];

      end;

      writeln('Gia tri lon nhat la: ', max);

      writeln('Gia tri nho nhat la: ', min);

      writeln('Gia tri trung binh la: ', TB:2:2);

      if minTB = TB then

            writeln('Khong co gia tri nao nho hon TB')

      else

            writeln('Gia tri nho nhat < TB la: ', minTB);

      if maxTB = TB then

            writeln('Khong co gia tri nao lon hon TB')

      else

            writeln('Gia tri lon nhat > TB la: ', maxTB);

      readln;

end.

 
  
Bình luận (0)
Bùi Thị Châu Loan
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2021 lúc 13:55

uses crt;

var n,i:integer;

m:real;

begin

clrscr;

repeat

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

until (1<=n) and (n<=30000);

m:=0;

for i:=1 to n do 

  m:=m+sqrt(i);

writeln('m=',m:4:2);

readln;

end.

Bình luận (1)
Tali
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 4 2021 lúc 23:03

uses crt;

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

i,n,dem:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

dem:=0;

for i:=1 to n do 

  if (10<a[i]) and (a[i]<20) then inc(dem);

writeln(dem);

readln;

end.

Bình luận (2)
Thảo Linhh
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 12 2020 lúc 8:04

uses crt;

var a,b:integer;

begin

clrscr;

repeat

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

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

until (a>0) and (b>0);

if a>b then writeln(a,' la so lon hon')

else if a<b then writeln(b,' la so lon hon')

else writeln('Hai so bang nhau');

readln;

end.

Bình luận (0)
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 Bảo Việt
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 10 2021 lúc 0:18

Bài 2: 

#include <bits/stdc++.h>;

using namespace std;

int main();

{

long m,n;

cout<<"Nhap m="; cin>>m;

cout<<"Nhap n="; cin>>n;

cout<<m*n-2;

return 0;

}

Bình luận (0)
Tali
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:40

Câu 4: 

uses crt;

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

i,n,dem,t:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

dem:=0;

t:=0;

for i:=1 to n do 

  if (10<a[i]) and (a[i]<20) then 

begin

inc(dem);

t:=t+a[i];

end;

writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);

writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:41

Câu 5:

uses crt;

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

i,n,dem,t:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

dem:=0;

t:=0;

for i:=1 to n do 

 if a[i] mod 2=0 then 

begin

inc(dem);

t:=t+a[i];

end;

writeln('So so chan la: ',dem);

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

readln;

end. 

Bình luận (0)