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.
Bài 3:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a%b;
cout<<a/b;
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a%b<<endl;
cout<<a/b;
return 0;
}
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;
}
program bai1;
uses crt;
var a,b,c,s: real;
begin
clrscr;
write('nhap so thu nhat ='); readln(a);
write('nhap so thu hai ='); readln(b);
write('nhap so thu ba ='); readln(c);
s:=a+b+c;
writeln('tong ba so a,b,c =',s:4:2);
readln;
end.
program bai1;
uses crt;
var n: integer;
begin
clrscr;
write('nhap so n ='); readln(n);
if n mod 2 = 0 then
writeln('la so chan ') else
writeln('la so le ');
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;
}
Var a:array[1..200] of real;
i,n,dem:integer;
s,tbc:real;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
s:=0;
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
tbc:=s/n;
Write('Trung binh cong la ',tbc:10:2);
Readln;
End.
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln('Tong hai so la: ',a+b);
writeln('Tong binh phuong hai so la: ',sqr(a)+sqr(b));
readln;
end.
Câu 2:
Program nii;
Uses crt;
Var a,b,c,A:integer;
Begin
Write ('nhap a');
Readln (a);
Write ('nhap b');
Readln (b);
Write ('nhap c');
Readln (c);
A:=a;
If A<b then A:=b;
If A<c then A:=c;
Write ('Ket qua',A);
Readln;
End.
Câu 1
Program ntg;
Uses crt;
Var A,x,y:integer;
Begin
Write ('nhap x');
Readln (x);
Write ('nhap y');
Readln ('y');
A:=x+y;
Write ('Ket qua',A);
Readln;
End.
uses crt;
var a:array[1..100]of real;
i,n:integer;
t:real;
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 cua day la: ',t:4:2);
writeln('Trung binh cong cua day la: ',t/n:4:2);
readln;
end.