K
Khách

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.

19 tháng 12 2021

#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;

}

uses crt;

var n,i,t,s:integer;

begin

clrscr;

repeat

readln(n);

until n<>0;

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

writeln(t);

s:=1;

for i:=1 to n do 

  if i mod 2=1 then s:=s*i;

writeln(s);

readln;

end.

24 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

double a,b,c,p;

int main()

{

cin>>a>>b>>c;

p=a+b+c;

cout<<fixed<<setprecision(2)<<p;

return 0;

}

3 tháng 10 2019

program hotrotinhoc;
function toigian(x,y: integer): integer;
var z: integer;
begin
while y<>0 do
begin
z:=x mod y;
x:=y;
y:=z;
end;
toigian:=x;
end;
var i,n,a,b,c,d: integer;
tu,mau: real;
begin
readln(a,b,c,d);
if (c=0) and (d=0) then write(a,' ',b);
if (c=0) and (d<>0) then write(c,'/',d,'=0');
if (c<>0) and (d<>0) then
if b/toigian(a,b)=1 then
writeln(a,'/',b,'=',(a/toigian(a,b))/b/toigian(a,b):1:0) else
writeln(a,'/',b,'=',(a/toigian(a,b)):1:0,'/',b/toigian(a,b):1:0);
if (c<>0) and (d<>0) then
begin
tu:=(a*d+c*b)/toigian(a*d+c*b,b*d);
mau:=(b*d)/toigian(a*d+c*b,d*b);
if (mau=1) or (tu=0) then writeln(a,'/',b,'+',c,'/',d,'=',tu/mau:1:0) else
writeln(a,'/',b,'+',c,'/',d,'=',tu:1:0,'/',mau:1:0);
tu:=(a*d-c*b)/toigian(a*d-c*b,b*d);
mau:=(b*d)/toigian(a*d-c*b,d*b);
if (mau=1) or (tu=0) then writeln(a,'/',b,'-',c,'/',d,'=',tu/mau:1:0) else
writeln(a,'/',b,'-',c,'/',d,'=',tu:1:0,'/',mau:1:0);
tu:=(a*c)/toigian(a*c,b*d);
mau:=(b*d)/toigian(a*c,b*d);
if mau=1 then writeln(a,'/',b,'*',c,'/',d,'=',tu/mau:1:0) else
writeln(a,'/',b,'*',c,'/',d,'=',tu:1:0,'/',mau:1:0);
tu:=(a*d)/toigian(a*d,b*c);
mau:=(b*c)/toigian(a*d,b*c);
if mau=1 then writeln(a,'/',b,'/',c,'/',d,'=',tu/mau:1:0) else
writeln(a,'/',b,'/',c,'/',d,'=',tu:1:0,'/',mau:1:0)
end;
readln
end.

27 tháng 10 2019

program hotrotinhoc;

function toigian(x,y: integer): integer;

var z: integer;

begin

while y<>0 do

begin

z:=x mod y;

x:=y;

y:=z;

end;

toigian:=x;

end;

var i,n,a,b,c,d: integer;

tu,mau: real;

begin

readln(a,b,c,d);

if (c=0) and (d=0) then write(a,' ',b);

if (c=0) and (d<>0) then write(c,'/',d,'=0');

if (c<>0) and (d<>0) then

if b/toigian(a,b)=1 then

writeln(a,'/',b,'=',(a/toigian(a,b))/b/toigian(a,b):1:0) else

writeln(a,'/',b,'=',(a/toigian(a,b)):1:0,'/',b/toigian(a,b):1:0);

if (c<>0) and (d<>0) then

begin

tu:=(a*d+c*b)/toigian(a*d+c*b,b*d);

mau:=(b*d)/toigian(a*d+c*b,d*b);

if (mau=1) or (tu=0) then writeln(a,'/',b,'+',c,'/',d,'=',tu/mau:1:0) else

writeln(a,'/',b,'+',c,'/',d,'=',tu:1:0,'/',mau:1:0);

tu:=(a*d-c*b)/toigian(a*d-c*b,b*d);

mau:=(b*d)/toigian(a*d-c*b,d*b);

if (mau=1) or (tu=0) then writeln(a,'/',b,'-',c,'/',d,'=',tu/mau:1:0) else

writeln(a,'/',b,'-',c,'/',d,'=',tu:1:0,'/',mau:1:0);

tu:=(a*c)/toigian(a*c,b*d);

mau:=(b*d)/toigian(a*c,b*d);

if mau=1 then writeln(a,'/',b,'*',c,'/',d,'=',tu/mau:1:0) else

writeln(a,'/',b,'*',c,'/',d,'=',tu:1:0,'/',mau:1:0);

tu:=(a*d)/toigian(a*d,b*c);

mau:=(b*c)/toigian(a*d,b*c);

if mau=1 then writeln(a,'/',b,'/',c,'/',d,'=',tu/mau:1:0) else

writeln(a,'/',b,'/',c,'/',d,'=',tu:1:0,'/',mau:1:0);

end;

readln

end.

19 tháng 12 2021

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;

}