Viết chương trình diện tích hình vuông tính tổng 2 sô a,b dc đc nhập từ bàn phím tích tích 2 số a,b đc nhập từ bàn phím
1 ) Viết chương trình tính diện tích và chu vi hình chữ nhật , với chiều dài và chiều rộng được nhập từ bàn phím 2 ) Viết chương trình tính diện tích và chu vi hình vuông , với cạnh được nhập từ bàn phím 3 ) Viết chương trình tính diện tích và chu vi tam giác , với độ dài ba cạnh và chiều cao tương ứng với cạnh đó và được nhập từ bàn phím bàn phím 4 ) Viết chương trình tính diện tích và chu vi hình tròn , với bán kính được nhập từ Yêu cầu : Viết công thức tính diện tích và chu vi của các hình vào vở Viết chương trình vào vở và làm trên phần mềm Python
Viết chương trình tính diện tích và chu vi hình chữ nhật. Với độ dài các cạnh nhập từ bàn phím.Biết : Diện tích = a*b, Chu vi = (a + b)*2;
3. Viết chương trình tính chu vi, diện tích của hình tròn với bán kính được nhập vào từ bàn phím ? C :=R*2*3.14 ; S := (R*R*3,14) ;
Giúp mình với ạ , gấp lắm xin cảm ơn trước ạ
Câu 2:
#include <bits/stdc++.h>
using namespace std;
double a,b,cv,dt;
int main()
{
cin>>a>>b;
cv=(a+b)*2;
dt=a*b;
cout<<"Chu vi la:"<<fixed<<setprecision(2)<<cv<<endl;
cout<<"Dien tich la:"<<fixed<<setprecision(2)<<dt;
return 0;
}
c1 Viết chương trình in ra màn hình trung bình cộng của 3 số dương a,b,c(a,b,c được nhập từ bàn phím)
c2 Viết chương trình tính chu vi và diện tích hình chữ nhật có chiều dài 2 cạnh a và b(được nhập từ bàn phím in ra kết quả màn hình)
Hộ mình với ạ đang cần gấp
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;
}
1. Viết chương trình tính tổng 2 số nguyên a, b.
2. Viết chương trình tính diện tích hình tròn với bán kính r nhập từ
bàn phím.
3. Viết chương trình nhập vào 1 ký tự. In ra màn hình vị trí ký tự đó
trong bảng mã ASCII
1:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a+b;
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
double s,r;
int main()
{
cin>>r;
s=r*r*pi;
cout<<fixed<<setprecision(2)<<s;
return 0;
}
giúp mình với, mình cảm ơn.
1.Viết chương trình nhập 2 số nguyên a, b từ bàn phím (b!=0), in tổng, hiệu, tích, thương phần nguyên a/b.
2.Viết chương trình nhập năm sinh của một người từ bàn phím, sau đó in ra lời chào và tuổi của người đó.
3.Viết chương trình nhập ba số thực a, b, c từ bàn phím là số đo 3 cạnh tam giác, sau đó tính và in chu vi, diện tích tam giác đó.
4.Viết chương trình nhập vào một số nguyên, sau đó in ra màn hình số đó là số chẵn hay lẻ.
5.Viết chương trình giải phương trình: ax^2+bx+c=0 với các hệ số a, b, c được nhập vào từ bàn phím.
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;
}
giúp mình với, mình cảm ơn.
1.Viết chương trình nhập 2 số nguyên a, b từ bàn phím (b!=0), in tổng, hiệu, tích, thương phần nguyên a/b.
2.Viết chương trình nhập năm sinh của một người từ bàn phím, sau đó in ra lời chào và tuổi của người đó.
3.Viết chương trình nhập ba số thực a, b, c từ bàn phím là số đo 3 cạnh tam giác, sau đó tính và in chu vi, diện tích tam giác đó.
4.Viết chương trình nhập vào một số nguyên, sau đó in ra màn hình số đó là số chẵn hay lẻ.
5.Viết chương trình giải phương trình: ax^2+bx+c=0 với các hệ số a, b, c được nhập vào từ bàn phím.
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;
}
1. Viết chương trình tính tích N=1*2*3*...*n (với n được nhập từ bàn phím)
2. Viết chương trình tính tổng A=1/1*3+1/2*4+1/3*5+...+1/n*(n+2)
3. Viết chương trình tính tổng số lẻ có trong dãy từ 0->n (n được nhập từ bàn phím)
4. Viết chương trình in ra màn hình các số chẵn có trong dãy từ 0->n (n được nhập từ bàn phím) và đếm có bao nhiêu số.
5. Viết chương trình in ra màn hình các số lẻ có trong dãy số từ 0->n (n được nhập từ bàn phím) và đếm có bao nhiêu số.
6. Viết chương trình nhập số nguyên n. Tìm và đưa ra màn hình các ước của n.
7. Viết chương trình in ra màn hình các bội của n ( n được nhập từ bàn phím)
8. Viết chương trình tính tổng S=1/1+1/2+1/3+...+1/n (n được nhập từ bàn phím)
Câu 6:
uses crt;
var n,i:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
if n mod i=0 then write(i:4);
readln;
end.
5:
uses crt;
var n,i,dem:integer;
begin
clrscr;
readln(n);
dem:=0;
for i:=0 to n do
if i mod 2=1 then
begin
write(i:4);
dem:=dem+1;
end;
writeln;
writeln(dem);
readln;
end.
Viết chương trình bảng cửu chương n với n nhập từ bàn phím.
Viết chương trình tính tổng các số chẵn đc nhập từ bàn phím.
TIN HỌC 8
câu 1 em hãy sử dụng công thức hê-rông lập chương trình tính và hiển thị ra màn hình máy tính diện tích hình tam giác với chiều dài 3 canh a,b,c được nhập từ bàn phím (lưu ý dùng p=(a+b+c)/2)
câu 2 hãy lập chương trình nhập từ bàn phím một dãy số nguyên n phần tử (với n<=100). Sau đó a) tính tổng giá trị các phần tử trong dãy và hiển thị ra màn hình
b) tìm và hiển thị ra màn hình phần tử có giá trị nhỏ nhất, lớn nhất trong dãy
Câu 1:
uses crt;
var a,b,c,p,s: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
begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Dien tich tam giac la: ',s:4:2);
end
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,t,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac phan tu trong day la: ',t);
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
readln;
end.