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.
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.
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.
Tổng n số tự nhiên đầu tiên:
Var i,n,s:integer;
Begin
Write('n = ');
for i:=1 to n do
s:=s+i;
Write('Tong la ',s);
Readln
End.
Tích các số từ 5 đến 30
Var i,p:longint;
Begin
p:=1;
For i:=5 to 30 do
P:=p*i;
Write('Tich la ',p);
Readln
End.
uses crt;
var a,b:real;
begin
clrscr;
readln(a,b);
writeln(2*(a+b):4:2);
writeln(a*b:4:2);
readln;
end.
Program Chu_nhat; uses crt;
Var a, b, S, CV: real;
Begin
Write('Nhap chieu dai:'); readln(a);
Write('Nhap chieu rong:'); readln(b);
S := a*b;
CV := (a+b)*2;
Writeln('Dien tich hinh chu nhat la:',S:3:2);
Writeln('Chu vi hinh chu nhat la:',CV:3:2);
readln;
end.
program Tim_So_Le_Chia_Het_Cho_3;
uses crt;
var
n, i, count: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
writeln('Cac so le chia het cho 3 nho hon ', n, ' la: ');
count := 0;
for i := 1 to n do
begin
if (i mod 2 = 1) and (i mod 3 = 0) then
begin
writeln(i);
count := count + 1;
end;
end;
writeln('Co tat ca ', count, ' so le chia het cho 3');
readln;
end.
uses crt;
var n,i,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=1 to n-1 do
if n mod i=0 then t:=t+i;
if t=n then writeln(n,' la so hoan chinh')
else writeln(n,' khong la so hoan chinh');
readln;
end.
Câu 1:
#include <bits/stdc++.h>
using namespace std;
double a,b,c;
int main()
{
cin>>a>>b>>c;
cout<<fixed<<setprecision(2)<<(a+b+c)/3;
return 0;
}
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,tb:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
writeln(tb/n:4:2);
readln;
end.
Program So_bac_thang;
Var i,n1,n2: integer;
Function BT(n:integer):Boolean;
Var ok: boolean;
so:byte;
Begin
ok:=true;
While n>=10 do
Begin
so:=n mod 10;
n:=n div 10;
if so < (n mod 10) then ok:=ok and false;
End;
BT:=ok;
End;
Begin
Write('Nhap so n1: ');Readln(n1);
Write('Nhap so n2: ');Readln(n2);
For i:= n1 to n2 do if BT(i) then Write(i:4);
Readln
End.