Những câu hỏi liên quan
Thanh Thủy Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 12 2021 lúc 22:52

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<max(a,b);

return 0;

}

Bình luận (1)
le thi minh phuong
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 1 2021 lúc 20:57

uses crt;

var n,i,d,x,j,tam:longint;

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

st:string;

begin

clrscr;

repeat

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

until n>0;

str(n,st);

d:=length(st);

for i:=1 to d do 

  begin

val(st[i],a[i],x);

end;

for i:=1 to d-1 do 

  for j:=i+1 to d do 

if a[i]<a[j] then 

begin

tam:=a[i];

a[i]:=a[j];

a[j]:=tam;

end;

for i:=1 to d do 

  write(a[i]);

readln;

end.

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

uses crt;

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

i,n,max,dem:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

max:=a[1];

for i:=1 to n do 

 if max<a[i] then max:=a[i];

writeln('So lon nhat la: ',max);

write('Vi tri cua so lon nhat la: ');

for i:=1 to n do 

  if max=a[i] then write(i:4);

writeln;

dem:=0;

for i:=1 to n do 

  if max=a[i] then inc(dem);

writeln('So luong phan tu lon nhat trong day la: ',dem);

readln;

end. 

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:18

uses crt;
var a:array[1..100000000] of int64;
      n,i,d,max:longint;
begin
        clrscr;
        repeat
                write('Nhap so luong phan tu: '); readln(n);
                if (n<=0) and (n>688886) then writeln('NHAP LAI!');
        until (n>0) and (n<=688886);
        for i:=1 to n do
                begin
                        write('Nhap phan tu thu ',i,': '); readln(a[i]);
                end;
        write('Day so vua nhap: ');
        for i:=1 to n do write(a[i],' ');
        max:=a[1];
        for i:=1 to n do if a[i]>max then max:=a[i];
        writeln;
        writeln('So lon nhat: ',max);
        write('Vi tri cua cac so lon nhat: ');
        for i:=1 to n do if a[i]=max then begin write(i,' '); inc(d) end;
        writeln;
        writeln('So luong so lon nhat: ',d);
        readln;
end.

Bình luận (0)
Đoàn Phạm Phương Vy
Xem chi tiết
Nguyễn Tiến Dũng
Xem chi tiết
datcoder
4 tháng 11 2023 lúc 0:04

Program HOC24;

var a,b,c,max: integer;

begin

readln(a,b,c);

max=a;

if max>b then max=b;

if max>c then max=c;

write('So lon nhat trong 3 so la: ',max);

readln;

end.

Bình luận (0)
Lê Thị Bảo Trâm
Xem chi tiết
Trần Đức Huy
6 tháng 2 2022 lúc 11:49

Chương trình nhập n và mảng hay nhập mảng chưa biết số hạng tử v

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

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,ln,t1,dem,s;

int main()

{

cin>>n;

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

ln=a[1];

for (i=1; i<=n; i++) ln=max(ln,a[i]);

cout<<ln<<endl;

t=0;

for (i=1; i<=n; i++) if (a[i]%2==0) t=t+a[i];

cout<<t<<endl;

dem=0;

for (i=1; i<=n; i++) if (a[i]<0) dem++;

cout<<dem<<" ";

s=1;

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

if ((a[i]%3==0) and (a[i]>0)) s=s*a[i];

cout<<s;

return 0;

}

Bình luận (1)
Kiều Vũ Linh
7 tháng 2 2022 lúc 8:37

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

i,n,max,s1,dem,s2:integer;

begin

write('Nhap so luong phan tu cua mang n = ');readln(n);

for i:=1 to n do

begin

write('Nhap phan tu thu ',i,' = ');readln(a[i]);

end;

max:=a[1];

for i:=2 to n do

if a[i] > max then max:=a[i];

for i:=1 to n do

begin

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

end;

for i:=1 to n do

begin

if a[i] < 0 then dem:=dem + 1;

end;

s2:=1;

for i:=1 to n do

begin

if (a[i] > 0) and (a[i] mod 3 = 0) then s2:=s2*a[i];

end;

writeln('gia tri lon nhat trong mang la ',max);

writeln('tong cac so chan la ',s1);

writeln('Co ',dem,' so am');

write('tich cac so duong va chia het cho 3 la ',s2);

end;

readln;

end.

Bình luận (0)
Ngọc hà
Xem chi tiết
Nhung
23 tháng 5 2022 lúc 22:38

program trungbinh;

uses crt;

var n,i: integer;

      s:real;

      A: array[1..1000] of integer;

begin

clrscr;

write('Nhap do dai day: '); readln(n);

writeln('Nhap gia tri cua day: ');

S:=0;

for i:=1 to n do

begin

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

readln(A[i]);

S:=S+A[i];

end;

S:=S/n;

write('Trung binh cua cac so cua day do la: ',S);

readln;

end.

Bình luận (0)
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)
Bùi Ngọc Khánh Huyền
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 8 2023 lúc 17:39

uses crt;

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

i,n,ln:integer;

begin

clrscr;

readln(n);

for i:=1 to n do

readln(a[i]);

ln:=0;

for i:=1 to n do

if trunc(sqrt(A[i]))=sqrt(a[i]) then 

begin

write(a[i]:4);

if ln<A[i] then ln:=A[i];

end;

writeln;

writeln('So chinh phuong lon nhat la: ',ln);

readln;

end.

Bình luận (1)