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.

D
datcoder
CTVVIP
28 tháng 11 2023

C++

#include<bits/stdc++.h>

using namespace std;

int main() {

const double pi = 3.14159;

double a,b,c;

cin >> a >> b >> c;

double sinc= sin(c*(pi/180));

cout << fixed << setprecision(2) << (a*b*sinc)/2 << endl;

return 0;

}

27 tháng 11 2023

import math

def tinh_dien_tich_tam_giac(a, b, goc_xen):
    goc_rad = math.radians(goc_xen)
    
    dien_tich = 0.5 * a * b * math.sin(goc_rad)
    
    return dien_tich

a = float(input("Nhập độ dài cạnh a: "))
b = float(input("Nhập độ dài cạnh b: "))
goc_xen = float(input("Nhập góc xen giữa hai cạnh (đơn vị độ): "))

dien_tich_tam_giac = tinh_dien_tich_tam_giac(a, b, goc_xen)
print("Diện tích tam giác là:", dien_tich_tam_giac)

17 tháng 9 2021

câu 1

Program Nguyen_to;

Var n,i:integer;

Function NT(n:integer):Boolean;

Var ok: Boolean;

i: integer;

Begin ok:=true;

for i:=2 to n-1 do if (n mod i)= 0 then ok:=ok and false;

if n < 2 then NT:=false else NT:=ok;

End;

Begin Write('Nhap n: ');

Readln(n); i:=n;

Repeat i:=i+1;

Until NT(i);

Write('So nguyen to nho nhat lon hon ',n, 'la: ',i);

Readln End.

17 tháng 9 2021

câu 2

uses crt;

const so: set of char=['0','1','2','3','4','5','6','7','8','9'];

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

st,b:string;

c,l,i,n,j:integer;

s, Max: integer;

begin clrscr;

write('Nhap xau:');

readln(st);

l:=length(st);

i:=1;

n:=0;

repeat if (st[i] in so) then begin b:='';

repeat b:=b+st[i];

inc(i);

until (not(st[i] in so)) or (i>l);

inc(n);

val(b,a[n],c);

end;

inc(i);

until i>l;

Max:=a[1];

for i:=2 to n do If Max<A[i] Then Max:=A[i];

Writeln('Phan tu lon nhat cua mang:', Max);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long a[100],n,i,ln,nn,vt1,vt2;

int main()

{

cin>>n;

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

ln=a[1];

nn=a[1];

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

{

ln=max(ln,a[i]);

nn=min(nn,a[i]);

}

cout<<ln<<" "<<nn;

return 0;

}

19 tháng 1 2022

Var n,i,vtl,vtn,so max,min:integer;

Begin

Write('Nhap so luong so = ');readln(n);

vtl:=0;

vtn:=0;

max:=-32768;

min:=32767;

For i:=1 to n do

Begin

Write('Nhap vao so thu ',i);readln(so);

If so > max then

Begin

Max:=so;

vtl:=i;

End;

If so < min then

Begin

Min:=so;

vtn:=i;

End;

Writeln('So lon nhat la ',max,' tai vi tri thu ',i);

Write('So nho nhat la ',min,' tai vi tri thu ',i);

Readln;

End.

uses crt;

var n,i,dem,j,t:integer;

kt:boolean;

begin

clrscr;

readln(n);

t:=0;

for i:=2 to n do 

begin

kt:=true;

for j:=2 to i-1 do 

  if i mod j=0 then kt:=false;

if kt=true then 

begin

write(i:4);

t:=t+i;

end;

end;

writeln;

writeln(t);

readln;

end.

9 tháng 5 2023

Var a:array:[1..1000] of real;

i,n,max,min,s:real;

Begin

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

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(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;

Write('Cac so vua nhap la ');

for i:=1 to n do write(a[i]:10:2):

Writeln;

Writeln('Tong la ',s:10:2);

Writeln('So nho nhat la ',min:10:2);

Write('So lon nhat la ',max:10:2);

Readln

End.

27 tháng 5 2023

var
  Mang: array[1..100] of Integer;
  N, i, Tong, Min, Max: Integer;

begin
  // Yêu cầu nhập độ dài của dãy số từ bàn phím
  Write('Nhap do dai cua day so: ');
  ReadLn(N);

  // Yêu cầu nhập các phần tử của dãy từ bàn phím
  for i := 1 to N do
  begin
    Write('Nhap phan tu thu ', i, ': ');
    ReadLn(Mang[i]);
  end;

  // In ra màn hình các số vừa nhập
  Write('Cac so vua nhap: ');
  for i := 1 to N do
  begin
    Write(Mang[i], ' ');
  end;
  WriteLn;

  // Tính tổng các phần tử của dãy số
  Tong := 0;
  for i := 1 to N do
  begin
    Tong := Tong + Mang[i];
  end;
  WriteLn('Tong cac phan tu cua day so la: ', Tong);

  // Tìm giá trị nhỏ nhất của dãy số
  Min := Mang[1];
  for i := 2 to N do
  begin
    if Mang[i] < Min then
      Min := Mang[i];
  end;
  WriteLn('Gia tri nho nhat cua day so la: ', Min);

  // Tìm giá trị lớn nhất của dãy số
  Max := Mang[1];
  for i := 2 to N do
  begin
    if Mang[i] > Max then
      Max := Mang[i];
  end;
  WriteLn('Gia tri lon nhat cua day so la: ', Max);

  ReadLn;
end.

14 tháng 12 2021

PROGRAM DIEN H TAM GIAC;
{Nhap vao do dai 3 canh tam giac. Tinh dien h tam giac ay}
VAR a,b,c,p,S:real;kt:boolean;{kt: kiem tra}
BEGIN
Write('Nhap a: ');readln(a);
Write('Nhap b: ');readln(b);
Write('Nhap c: ');readln(c);
Writeln;
kt:=(a>0)and(b>0)and(c>0)and(a+b>c)
and(b+c>a)and(a+c>b);
If kt=true then
begin
p:=(a+b+c)/2;
S:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Dien h S= ',S:6:2);
end
Else writeln(,'Khong thuc hien vi day khong la do dai 3 canh tam giac');
Readln
END.

* Xin chú ý với bạn rằng: Trước khi tính diện tích tam giác, ta phải kiểm tra xem ba độ dài a, b, c có phải là ba cạnh của tam giác hay không, cho nên cần phải có biến kt:boolean;{kt: kiem tra}

kt:=(a>0)and(b>0)and(c>0)and(a+b>c)
and(b+c>a)and(a+c>b)

28 tháng 4 2023

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

i,n,d,max:integer;

begin

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

for i:=1 to n do

begin

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

if a[i] mod 2 <> 0 then d:=d+1;

end;

max:=a[1];

for i:=2 to n do

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

writeln('Co ',d,' so le');

write('So lon nhat la ',max);

readln

end.

D
datcoder
CTVVIP
22 tháng 1

Program HOC24;

var x: integer;

begin

write('Nhap so: '); readln(x);

if x div 1000=1 then write('Mot nghin ');

if x div 1000=2 then write('Hai nghin ');

if x div 1000=3 then write('Ba nghin ');

if x div 1000=4 then write('Bon nghin ');

if x div 1000=5 then write('Nam nghin ');

if x div 1000=6 then write('Sau nghin ');

if x div 1000=7 then write('Bay nghin ');

if x div 1000=8 then write('Tam nghin ');

if x div 1000=9 then write('Chin nghin ');

if x div 1000<>0 then

if x div 100=0 then write('khong tram ');

if x div 100=1 then write('mot tram ');

if x div 100=2 then write('hai tram ');

if x div 100=3 then write('ba tram ');

if x div 100=4 then write('bon tram ');

if x div 100=5 then write('nam tram ');

if x div 100=6 then write('sau tram ');

if x div 100=7 then write('bay tram ');

if x div 100=8 then write('tam tram ');

if x div 100=9 then write('chin tram ');

if (x div 1000<>0) or (x div 100<>0) then

begin

if (x div 10<>0) then

begin

if x div 10=1 then write('muoi ');

if x div 10=2 then write('hai muoi ');

if x div 10=3 then write('ba muoi ');

if x div 10=4 then write('bon muoi ');

if x div 10=5 then write('nam muoi ');

if x div 10=6 then write('sau muoi ');

if x div 10=7 then write('bay muoi ');

if x div 10=8 then write('tam muoi ');

if x div 10=9 then write('chin muoi ');

if x mod 10=1 then write('mot');

if x mod 10=2 then write('hai');

if x mod 10=3 then write('ba');

if x mod 10=4 then write('bon');

if x mod 10=5 then write('lam');

if x mod 10=6 then write('sau');

if x mod 10=7 then write('bay');

if x mod 10=8 then write('tam');

if x mod 10=9 then write('chin');

end else

begin

if x mod 10=1 then write('le mot');

if x mod 10=2 then write('le hai');

if x mod 10=3 then write('le ba');

if x mod 10=4 then write('le tu');

if x mod 10=5 then write('le nam');

if x mod 10=6 then write('le sau');

if x mod 10=7 then write('le bay');

if x mod 10=8 then write('le tam');

if x mod 10=9 then write('le chin');

end;

readln

end.

D
datcoder
CTVVIP
4 tháng 11 2023

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.

30 tháng 10 2021

uses crt;

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

i,n:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

for i:=1 to n do 

  write(a[i]:4);

writeln;

for i:=1 to n do 

  if (a[i]+a[i+1] mod 10=0) then 

begin

writeln(a[i],' ',a[i+1]);

writeln(i,' ',i+1);

end;

readln;

end.

9 tháng 11 2021

Có vẻ saii ;\