Viết chương trình nhập vào 2 số a, b từ bàn phím .Nếu a = b thì thông báo a bằng b, nếu a > b thì thông báo a lớn hơn b, Nếu a < b thì thông báo A nhỏ hơn b.
Câu 1: Nhập vào 3 cạnh a,b,c của 1 tam giác. Viết chương trình cho biết đây có phải là 1 tam giác vuông không?
Câu 2: Viết chương trình tính kết quả của a chia b, với a,b được nhập từ bàn phím. Nếu trường hợp b<0 thì in thông báo phép chia không thực hiện được.
Giúp iem với ạ :<
Viết chương trình nhập vào từ bàn phím bà số tự nhiên a,b,c: a) thông báo ra màn hình số a là số chẵn hay số lẻ
b)thông báo ra màn hình số b là số chẵn hay số lẻ
c) thông báo ra màn hình số c là số chẵn hay số lẻ
d) thông báo ra số lớn nhất trong ba số đó
Ai giúp mik với ạ
uses crt;
var a,b,c,max:integer;
begin
clrscr;
write('nhap ba so:');readln(a,b,c);
if a mod 2=0 then writeln(a,' la so chan')
else writeln(a,'la so le);
if b mod 2=0 then writeln(b,'la so chan')
else writeln(b,'la so le');
if c mod 2=0 then writeln(c,'la so chan')
else writeln(c,'la so le');
max:=a;
if max<b then max:=b;
if max<c then max:=c;
writeln('so lon nhat trong ba so la:',max);
readln
end.
Viết chương trình kiểm tra 3 số a,b,c có là ba cạnh của một tam giác hay ko với a,b,c là số được nhập từ bàn phím
số hợp lệ là số lớn hơn 100 bé hơn 1000.Viết chương trình nhập vào 1 số nguyên từ bàn phím và thông báo số nguyên đó có hợp lệ hay ko?
GIÚP MIK VS Ạ MIK CẦN GẤP
MIK SẮP THI RỒI GIÚP MIK VS
Uses crt;
Var a, b, c:real;
Begin
Readln(a);
Readln(b);
Readln(c);
If (a + b > c) or (a + c > b) or (b + c > a) then writeln('tam giác')
Else writeln('Khong phai tam giac');
Readln
End.
Viết chương trình nhập số nguyên a khác 10 , nếu a > 10 in ra màn hình câu thông báo " bạn nhập số lớn hơn 10 " ngược lại in ra câu thông báo " bạn nhập số nhỏ hơn 10"
#include <bits/stdc++.h>
using namespace std;
int a;
int main()
{
cin>>a;
if (a>10) cout<<"ban nhap so lon hon 10";
else cout<<"ban nhap so nho hon 10";
return 0;
}
Bài 1. Viết chương trình nhập vào 1 mảng a gồm n phần tử nguyên được nhập từ bàn phím.
a) Tính tổng các số chẵn và lớn hơn 10? Thông báo kết quả và in mảng ra màn hình?
b) Đếm các số lẻ hoặc nhỏ hơn 100? Thông báo kết quả và in mảng ra màn hình?
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
em hãy viết chương trình nhập vào 2 số a và b yêu cầu tính tổng hiệu tích thương của 2 số đó nếu b là số 0 thì thông báo là không tính được
#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;
}
giúp em với 2 câu thôi ạ :
viết chương trình nhập vào xâu bất kì từ bàn phím , ghi xâu sau khi loại bỏ các dấu cách ra tệp D:\ketqua.txt
viết chương trình nhập vào từ bàn phím 4 số bất A,B,C. tìm và thông báo kết quả ra màn hình giá trị nhỏ nhất MIN của 4 số đó có sử dụng chương trình con
1:
uses crt;
const fi='ketqua.txt'
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(f1,st);
close(f1);
end.
2:
uses crt;
var a,b,c,d:integer;
{----------chuong-trinh-con-----------------------}
function min(x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
{---------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
write('d='); readln(d);
writeln(min(a,min(b,min(c,d))));
readln;
end.
viết chương trình nhập số nguyên dương A và B máy hỏi tổng hai số là bao nhiêu
nếu ta nhập đúng thì máy thông báo "chúc mừng bạn đã tính đúng"
nếu ta nhập sai thì máy thông báo "rất tiếc bạn đã làm sai" và hiển thị kết quả đúng ra màn hình
mọi người giúp em với ôn thi căng quá
#include <bits/stdc++.h>
using namespace std;
long long a,b,t;
int main()
{
cin>>a>>b>>t;
if (t==a+b) cout<<"chuc mung ban da tinh dung";
else cout<<"rat tiec ban da lam sai";
return 0;
}