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 1
program hieu_thuong;
uses crt;
var a,b,h,t:real;
begin
write('nhap so a:');readln(a);
write('nhap so b:');readln(b);
if a>=b then h:=a-b else h:=b-a;
t:=a/b;
writeln('hieu cua hai so ',a,'',b,' la ',h);
writeln('thuong cua hai so ',a,'',b,' la ',t);
readln;
end.
câu 2
program chuvi_dientich;
uses crt;
var cv,dt,d,r:real;
begin
write('nhap chieu dai d:');readln(d);
write('nhap chieu rong r:');readln(r);
cv:=( d + r ) * 2 ;
dt:= d * r ;
writeln('chu vi thua ruong la : ',cv);
writeln('dien tich thua ruong la : ',dt);
readln;
end.
uses crt;
var a,b:int64;
begin
clrscr;
readln(a,b);
writeln(a+b);
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;
}
Trả lời:
Uses Crt; Var a, b, kq: Real; Pt: Char;
BEGIN
Clrscr;
Write ('a ='); Readln(a);
Write ('b ='); Readln(b);
Write ('Phep tinh can thuc hien la (+ - * /): ');
Readln(Pt);
If Pt = '+’ Then kq := a + b;
If Pt = '-’ Then kq := a - b;
If Pt = '*’ Then kq := a * b;
If Pt = '/’ Then kq := a / b;
Write (a, pt, b, '=', kq);
Readln;
END.
uses crt;
var a:array[1..100]of integer;
i,n: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
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Cac so chan: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
readln;
end.