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.
Program HOC24;
var m,n,i: integer;
t1,t2: longint;
begin
write('Nhap m;n: '); readln(m,n);
t1:=1; t2:=1;
for i:=1 to n do t1:=t1*i;
for i:=m to n do t2:=t2*i;
writeln('T1=',t1);
write('T2=',t2);
readln
end.
program im_14424;
uses crt;
var m: interger;
begin
clrscr;
write('Nhap vap so nguyen duong m: ');
readln(m);
if m>0 and m mod 2 = 0 then write('So nguyen duong m la so chan');
if m>0 and m mod 2 <> 0 then write('So nguyen duong m la so le);
if m<0 then write('m khum phai la so nguyen duong');
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n%2==0) cout<<"La so chan";
else cout<<"La so le";
return 0;
}
1:
#include <bits/stdc++.h>
using namespace std;
int n,x,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;
}
Tham khảo!
program baitap;
uses crt;
var a:integer;
procedure chanle(x:integer);
begin
if ((x mod 2) = 0) then write('So nhap vao la so chan.') else
write('So nhap vao la so le.');
end;
begin
clrscr;
write('Nhap a: ');readln(a);
chanle(a);
readln;
end
uses crt;
var a:array[1..10]of integer;
i,n,dem:integer;
begin
clrscr;
for i:=1 to 10 do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>0;
end;
writeln('Day so vua nhap la: ');
for i:=1 to 10 do
write(a[i]:4);
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln;
writeln('So luong so chan la: ',dem);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,a[1000],m,i;
bool kt;
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cin>>m;
kt=false;
for (i=1; i<=n; i++)
if (a[i]==m) kt=true;
if (kt==true) cout<<"Co";
else cout<<"Khong";
return 0;
}
Câu 4:
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
char x;
int main()
{
getline(cin,st);
d=st.length();
cout<<st<<endl;
cin>>x;
dem=0;
for (i=0; i<=d-1; i++) if (st[i]==x) dem++;
cout<<dem;
return 0;
}
Câu 4:
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,dem;
char x;
int main()
{
getline(cin,st);
d=st.length();
cout<<st<<endl;
cin>>x;
dem=0;
for (i=0; i<=d-1; i++) if (st[i]==x) dem++;
cout<<dem;
return 0;
}
uses crt;
var m:integer;
begin
clrscr;
write('Nhap m='); readln(m);
if m mod 2=0 then writeln(m,' la so chan')
else writeln(m,' la so le');
writeln('Binh phuong cua ',m,' la: ',sqr(m));
writeln('Can bac hai cua ',m,' la: ',sqrt(m));
writeln('Gia tri tuyet doi cua ',m,' la: ',abs(m));
readln;
end.