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.
uses crt;
var a,b:integer;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
until (a>0) and (b>0);
if a>b then writeln(a,' la so lon hon')
else if a<b then writeln(b,' la so lon hon')
else writeln('Hai so bang nhau');
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 7=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 7 la: ',t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i:integer;
begin
clrscr;
for i:=1 to 100 do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>0;
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,i,dem,s;
int main()
{
cin>>a>>b;
dem=0;
s=0;
for (i=a; i<=b; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<dem<<" "<<s;
return 0;
}
Bài 2:
#include <bits/stdc++.h>;
using namespace std;
int main();
{
long m,n;
cout<<"Nhap m="; cin>>m;
cout<<"Nhap n="; cin>>n;
cout<<m*n-2;
return 0;
}
uses crt;
var a,b,c:string;
i,d1,d2:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
write('Nhap xau b:'); readln(b);
d1:=length(a);
d2:=length(b);
writeln('Tong do dai hai xau la: ',d1+d2);
c:=#32;
for i:=1 to d1 do
if (a[i] in ['A'..'Z']) or (a[i] in ['a'..'z']) then c:=c+a[i];
for i:=1 to d2 do
if b[i] in ['0'..'9'] then c:=c+b[i];
writeln('Xau c la: ',c);
readln;
end.
Bài 1:
uses crt;
var a:array[1..200]of integer;
i,n,t: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
if a[i] mod 5=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 5 la: ',t);
readln;
end.
Bài 2:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(st);
readln;
end.
#Include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
cin>>a>>b>>c;
cout<<a+b+c<<endl;
cout<<a-b-c<<endl;
cout<<a*b*c;
return 0;
}