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.

22 tháng 3 2023

a = int(input("Nhập chiều dài: "))

b = int(input("Nhập chiều rộng: "))

chu_vi = 2*(a+b)

dien_tich = a*b

print(f"Chu vi hình chữ nhật là: {chu_vi}")

print(f"Diện tích hình chữ nhật là: {dien_tich}")

19 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

t=0;

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

if (i%2==0) t=t+i;

cout<<t;

return 0;

}

14 tháng 3 2023

n = int(input())
if n % 2 != 0:
    n -= 1
so_so_hang = (n - 2) // 2 + 1
print((n + 2)*so_so_hang // 2)

18 tháng 12 2022

Cau 1:

var i,dem:integer;

function ngto(n:longint):boolean;
var bo:boolean;
i:longint;
begin
    bo:=true;
    for i:=2 to n-1 do 
    if n mod i=0 then bo:=false;
    if n>1 then ngto:=bo else ngto:=false;
end;
begin
    for i:=2 to 100 do 
    if ngto(i) then dem:=dem+i;
    write(dem);
readln;
end.

Cau 2:

var i,dem,n:longint;

begin
    read(n);
    dem:=1;
    for i:=1 to n do 
    dem:=dem*i;
    write(dem);
readln;
end.

12 tháng 3 2023

Program HOC24;

var i,n: integer;

t: longint;

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

begin

write('Nhap so phan tu : '); readln(n);

for i:=1 to n do 

begin

write('Nhap so thu ',i,': '); readln(a[i]);

end;

t:=0;

for i:=1 to n do t:=t+a[i];

write('Ket qua la: ',t);

readln

end.

7 tháng 2 2023

 

26 tháng 4 2023

program TongSoChan;

var
  n, i, x, tong: integer;

begin
  write('Nhap so nguyen n: ');
  readln(n);
  
  tong := 0;
  
  for i := 1 to n do
  begin
    read(x);
    if x mod 2 = 0 then
      tong := tong + x;
  end;
  
  writeln('Tong cac so chan la: ', tong);
  readln; 
end.

26 tháng 4 2023

program Tong;
var
  n: integer;
  i: integer;
  sum: real;
begin
  write('Nhap so nguyen duong n (chia het cho 5): ');
  readln(n);
 
  sum := 0;
  for i := 1 to n do
  begin
    if i mod 5 = 1 then
      sum := sum + 1/i;
  end;
  
  writeln('Tong A la: ', sum);
  readln;
end.