K
Khách

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.

19 tháng 10 2021

#include <bits/stdc++.h>
using namespace std;
int main() {
double BMI, khoiluong, chieucao;
cin >> khoiluong >> chieucao;
BMI=khoiluong/(chieucao*2);
cout << BMI << endl;
return 0;
}

Chúc bn học tốt!

24 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[1000];

int main()

{

cin>>n;

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

sort(a+1,a+n+1);

for (i=n; i>=1; i--) cout<<a[i]<<" ";

return 0;

}

2:

uses crt;

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

i,n,dem,kt,j:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

b[1]:=a[1];

dem:=1;

for i:=1 to n do 

  begin

kt:=0;

for j:=1 to dem do 

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

if kt=0 then 

begin

inc(dem);

b[dem]:=a[i];

end;

end;

for i:=1 to n do 

  write(a[i]:4);

readln;

end.

uses crt;

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

i,n,dem1,dem2,t1,t2,sa,sd,vt1,vt2:integer;

begin

clrscr;

readln(n);

for i:=1 to n do readln(a[i]);

dem1:=0;

t1:=0;

dem2:=0;

t2:=0;

for i:=1 to n do 

begin

if a[i]>0 then begin inc(dem1); t1:=t1+a[i]; end;

if a[i]<0 then begin inc(dem2); t2:=t2+a[i]; end;

end;

writeln(dem1);

writeln(dem2);

writeln(t1);

writeln(t2);

for i:=1 to n do 

  if a[i]>0 then 

begin

sd:=a[i];

vt1:=i;

break;

end;

if (dem1=0) then writeln('Khong co so duong trong day')

else writeln('So duong dau tien la: ',sd,' vi tri la: ',vt1);

for i:=1 to n do 

  if a[i]<0 then 

begin

sa:=a[i];

vt2:=i;

break;

end;

if (dem2=0) then writeln('Khong co so am trong day')

else writeln('So am dau tien la: ',sa,' vi tri la: ',vt2);

readln;

end.

18 tháng 1 2021

Program HOC24;

var s: string;

tg,d,max,i: byte;

code: integer;

begin

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

// cau a

for i:=1 to length(s) do if s[i] in ['a'..'z'] then write(upcase(s[i]));

//------

writeln;

//-cau b

for i:=length(s) downto 1 do if s[i] in ['0'..'9'] then write(s[i]);

//------

writeln;

//---cau c

d:=0;

for i:= 1 to length(s) do

if s[i] in ['0'..'9'] then 

begin

val(s[i],tg,code);

if tg>max then max:=tg;

d:=d+1;

end;

if d=0 then write('Khong co chu so trong day') else write('Chu so lon nhat la : ',max);

readln 

end.

uses crt;

var st,st1:string;

d,i,d1,max,x,y:integer;

begin

clrscr;

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

d:=length(st);

writeln('Day cac ki tu thuong doi sang chu hoa la: ');

for i:=1 to d do 

  if st[i] in ['a'..'z'] then write(upcase(st[i]):4);

st1:='';

for i:=1 to d do 

  if st[i] in ['0'..'9'] then st1:=st1+st[i];

d1:=length(st1);

for i:=d1 downto 1 do 

  write(st1[i]:4);

writeln;

max:=0;

for i:=1 to d1 do 

  begin

val(st1[i],x,y);

if max<x then max:=x;

end;

writeln('Chu so lon nhat trong xau la: ',max);

readln;

end.

27 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

double a,b,c,p,s;

int main()

{

cin>>a>>b>>c;

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));

cout<<"Chu vi la:"<<fixed<<setprecision(2)<<p*2<<endl;

cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s;

return 0;

}

16 tháng 12 2020

uses crt;

var a,b,c:array[1..250]of integer;     i,n,dem,dem1,sd,vtd,sa,vta,sdcc,sacc,vtd1,vtc1:integer;

begin

clrscr;

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

for i:=1 to n do  

begin      

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

end;

dem:=0;

dem1:=0;

for i:=1 to n do  

begin      

if a[i]>0 then        

begin            

dem:=dem+1;            

b[dem]:=a[i];        

end;      

if a[i]<0 then        

begin            

inc(dem1);            

c[dem1]:=a[i];        

end;  

end;

writeln('So duong dau tien trong day la: ',b[1]);

sd:=b[1];

vtd:=n;

for i:=n downto 1 do  

if sd=a[i] then      

begin        

if vtd>i then vtd:=i;      

end;

writeln('Chi so cua no la: ',vtd);

writeln('So am dau tien trong day la: ',c[1]);

sa:=c[1];

vta:=n;

for i:=n downto 1 do  

if sa=a[i] then      

begin        

if vta>i then vta:=i;      

end;

writeln('Chi so cua no la: ',vta);

writeln('So duong cuoi cung trong day la: ',b[dem]); sdcc:=b[dem];

vtd1:=1;

for i:=1 to n do  

if sdcc=a[i] then    

begin        

if vtd1<i then vtd1:=i;      

end;

writeln('Chi so cua no la: ',vtd1);

writeln('So am cuoi cung trong day la: ',c[dem]); sacc:=c[dem];

vtc1:=1;

for i:=1 to n do  

if sacc=a[i] then      

begin        

if vtc1<i then vtc1:=i;      

end;

writeln('Chi so cua no la: ',vtc1);

readln;

end.