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.

#include <bits/stdc++.h>

using namespace std;

double a,b;

int main()

{

cin>>a>>b;

cout<<fixed<<setprecision(2)<<a+b<<endl;

cout<<fixed<<setprecision(2)<<a-b;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i;

int main()

{

getline(cin,st);

d=st.length();

for (i=0; i<d; i++)

if ((int(st[i])>=48) and (int(st[i])<=57)) cout<<st[i]<<" ";

cout<<endl;

for (i=0; i<=d-1; i++)

if ((int(st[i])>=48) and (int(st[i])<=57)) cout<<i<<" ";

return 0;

}

2:

#include <bits/stdc++.h>

using namespace std;

double a,b,c;

int main()

{

cin>>a>>b>>c;

cout<<fixed<<setprecision(2)<<pow(a,3)+pow(b,5)+pow(c,8);

return 0;

}

uses crt;

const fi='dulieu.dat';

var f1:text;

a,b,p,s:array[1..100]of real;

i,n:integer;

begin

clrscr;

assign(f1,fi); reset(f1);

n:=0;

while not eof(f1) do 

begin

n:=n+1;

readln(a[n],b[n]);

end;

for i:=1 to n do 

  begin

p[i]:=(a[i]+b[i])/2;

s[i]:=a[i]*b[i];

end;

for i:=1 to n do 

  writeln(p[i]:4:2,' ',s[i]:4:2);

close(f1);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t,c,d;

int main()

{

cin>>n;

cin>>c>>d;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if ((c<=x) and (x<=d)) t=t+x;

}

cout<<t;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (x%2!=0) t=t+x;

}

cout<<t;

return 0;

}

const fi='dulieu.txt';

fo='ketqua.txt';

var f1,f2:text;

a,b:array[1..100]of integer;

n,i:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do

begin

n:=n+1;

readln(f1,a[n],b[n]);

end;

for i:=1 to n do 

begin

if (a[i]<b[i]) then writeln(f2,a[i])

else writeln(f2,b[i]);

end;

close(f1);

close(f2);

end.

 

 

 

 

 

#include <bits/stdc++.h>
using namespace std;
long long a,b;
//chuongtrinhcon
long long gcd(long long a,long long b)
{
    if (b==0) return(a);
    return gcd(b,a%b);
}
//chuongtrinhchinh
int main()
{
    cin>>a>>b;
    if ((a>0 && b>0) or (a<0 && b<0)) cout<<a/gcd(a,b)<<" "<<b/gcd(a,b);
    else cout<<"-"<<-a/gcd(-a,b)<<" "<<b/gcd(-a,b);
    return 0;
}