Câu 1 .Viết trương trình. tổng , hiệu, tích, thương của 2 số a , b
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.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float a,b,t,h,s,thuong;
cout<<"Nhap a,b: ";
cin>>a>>b;
t=a+b;
h=a-b;
s=a*b;
thuong=a/b;
cout<<a<<"+"<<b<<"="<<fixed<<setprecision(2)<<t<<endl;
cout<<a<<"-"<<b<<"="<<fixed<<setprecision(2)<<h<<endl;
cout<<a<<"*"<<b<<"="<<fixed<<setprecision(2)<<s<<endl;
cout<<a<<"/"<<b<<"="<<fixed<<setprecision(2)<<thuong<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int x, y;
cout << "x : "; cin >> x;
cout << "y : "; cin >> y;
cout << "x + y = " << x + y;
cout << "x - y = " << x - y;
cout << "x * y = " << x * y;
cout << "x / y = " << x / y;
return 0;
}
Câu 3:
#include <bits/stdc++.h>
using namepsace 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<<fixed<<setprecision(2)<<s;
return 0;
}
Câu 3:
#include <bits/stdc++.h>
using namepsace 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<<fixed<<setprecision(2)<<s;
return 0;
}
Câu 3:
#include <bits/stdc++.h>
using namepsace 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<<fixed<<setprecision(2)<<s;
return 0;
}
Câu 1:
uses crt;
var a,s,p:real;
begin
clrscr;
repeat
write('Nhap do dai canh hinh vuong:'); readln(a);
until a>0;
p:=4*a;
s:=sqr(a);
writeln('Chu vi hinh vuong la: ',p:4:2);
writeln('Dien tich hinh vuong la: ',s);
readln;
end.
Câu 2:
uses crt;
var a,b,t,s,h:real;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
t:=a+b;
h:=a-b;
s:=a*b;
writeln('Tong la: ',t:4:2);
writeln('Hieu la: ',h:4:2);
writeln('Tich la: ',s:4:2);
readln;
end.
Câu 3:
uses crt;
var a,b,c:real;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
until (a>0) and (b>0) and (c>0);
if (a+b>c) and (a+c>b) and (b+c>a) then writeln('Day la ba canh trong mot tam giac')
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
if (b==0) cout<<"Ko tinh duoc";
else
{
cout<<a+b<<endl;
cout<<a-b<<endl;
cout<<a*b<<endl;
cout<<a/b;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a+b<<endl;
cout<<a-b<<endl;
cout<<a*b<<endl;
cout<<fixed<<setprecision(1)<<(a*1.0)/(b*1.0);
return 0;
}
var a,b:integer;
begin
write(' Nhap a: ');readln(a);
write(' Nhap b: ');readln(b);
writeln(' Tong la: ',a+b);
writeln(' Hieu la: '.a-b);
writeln(' Tich la: ',a*b);
writeln(' Thuong la: ',a/b);
readln;
end.