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 st:string;
i,d,dem:integer;
b:char;
begin
clrscr;
write('Nhap xau st:'); readln(st);
d:=length(st);
write('Nhap ki tu b:'); readln(b);
dem:=0;
for i:=1 to d do
if b=st[i] then inc(dem);
writeln(dem);
readln;
end.
Câu 2:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln('Tong a+b la ',a+b);
writeln('Hieu a-b la ',a-b);
writeln('Tich cua a*b la ',a*b);
writeln('Thuong cua a/b la ',a/b:4:2);
readln;
end.
Câu 2: (C++)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << "Tong a+b la: " << a+b << "\nHieu a-b la: " << a-b << "\nTich a*b la: " << a*b << "\nThuong a/b la: " << (double)a/b << endl;
return 0;
}
Chúc bn học tốt!
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,k;
cin>>a>>b>>k;
for (int i=a; i<=b; i++)
if (i%k==0) cout<<i<<" ";
return 0;
}
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,min,dem1,dem2,t1,t2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
dem1:=0;
dem2:=0;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then
begin
inc(dem1);
t1:=t1+a[i];
end
else begin
inc(dem2);
t2:=t2+a[i];
end;
end;
writeln('So so chan la: ',dem1);
writeln('So so le la: ',dem2);
writeln('Tong cac so chan la: ',t1);
writeln('Tong cac so le la: ',t2);
readln;
end.
Câu 1:
const fi='dulieu.inp';
fo='ketqua.out';
var f1,f2:text;
m,n,t,i:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m,n);
t:=0;
for i:=m to n do
if i mod 2=1 then t:=t+i;
writeln(f2,t);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
freopen("songuyen.inp","r",stdin);
freopen("ketqua.out","w",stdout);
cin>>a>>b;
cout<<a+b<<endl;
cout<<a-b<<endl;
cout<<a*b<<endl;
cout<<a/b;
return 0;
}