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.
1:
#include <bits/stdc++.h>
using namespace std;
double a;
int main()
{
cin>>a;
cout<<a*a;
return 0;
}
program tim_chu_so;
uses crt;
var i,n,csln:longint;
k:integer;
a:array[1..1000]of longint;
st:string;
begin
clrscr;
write('nhap so n:');readln(n);
str(n,st);
val(st,a[i]);
csln:=a[1];
for i:=1 to length(st) do
if csln<a[i] then csln:=a[i];
writeln('chu so lon nhat cua so ',n,' la:',csln);
readln;
end.
Câu 1:
uses crt;
var n,i,d,x,y,max:integer;
st:string;
begin
clrscr;
write('Nhap n='); readln(n);
str(n,st);
d:=length(st);
max:=0;
for i:=1 to d do
begin
val(st[i],x,y);
if max<x then max:=x;
end;
writeln('Chu so lon nhat la: ',max);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a*b<<endl;
cout<<fixed<<setprecision(2)<<(a*1.0)/(b*1.0);
return 0;
}
Câu 1:
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
if (a<b) cout<<a;
else cout<<b;
return 0;
}
program tim_tong_va_tich;
uses crt;
var n,i:integer;
tong,tich:longint;
a:array[1..100]of integer;
begin
write('nhap so n:');readln(n);
i:=1;tich:=1;tong:=0;
while i<=n do
begin
write('nhap phan tu a[',i,']:');readln(a[i]);
tong:=tong+a[i];tich:=tich+a[i];
i:=i+1;
end;
writeln('tong cua cac so tren la:',tong);
writeln('tich cua cac so tren la:',tich);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
float a,b;
void main()
{
cin>>a>>b;
cout<<"Tich la: "<<a*b;
Return 0;
}
Python:
a=int(input('a= '))
b=int(input('b= '))
if a<b:
print('a la so be nhat')
if a>b:
print('b la so be nhat')
else:
print('a=b')
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
if (a<b) then write(a)
else write(b);
readln;
end.
Cách khác(Dùng bằng C++)
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
cout<<"Tong la:"<<fixed<<setprecision(2)<<a+b<<endl;
cout<<"Tich la:"<<fixed<<setprecision(2)<<a*b;
return 0;
}