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.
Bài 1:
uses crt;
var m,n,i,t:integer;
begin
clrscr;
write('Nhap m='); readln(m);
write('Nhap n='); readln(n);
t:=0;
for i:=m to n do
t:=t+i;
writeln(t);
readln;
end.
2:
uses crt;
var n:integer;
{---------------chuong-trinh-con-kiem-tra-chan-le---------------------}
function ktcl(x:integer):boolean;
begin
if x mod 2=0 then ktcl:=true
else ktcl:=false;
end;
{--------------------chuong-trinh-con-kiem-tra-duong-am-------------------}
fucntion ktda(x:integer):boolean;
begin
if x>0 then ktda:=true
else if x<0 then ktda:=false;
end;
{--------------------chuong-trinh-chinh-------------------------}
begin
clrscr;
write('Nhap n='); readln(n);
if ktcl(n)=true then writeln('Day la so chan')
else writeln('Day la so le');
if ktda(n)=true then writeln('Day la so duong')
else writeln('Day la so am');
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.
Tham khảo
program So_chan_hay_le;
uses crt;
var m : integer;
begin
clrscr;
writeln('Nhap so m'); readln(m);
if m mod 2 = 0 then
writeln('Day la so chan')
else writeln('Day la so le');
readln;
end.
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;
}
Program Tin_hoc;
Uses Crt;
Var N: Integer;
Begin
Write('Nhap so nguyen N');
Readln(N);
If N>0 then write(' So do la so duong ');
If N<0 then write(' So do la so am ');
If N=0 then write(' So do khong la so am va so duong');
Readln;
End.
Program Tin_hoc;
Uses Crt;
Var N: Integer;
Begin
Write('Nhap so nguyen N');
Readln(N);
If N>0 then write(' So do la so duong ');
If N<0 then write(' So do la so am ');
If N=0 then write(' So do khong la so am va so 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;
}
TK:
uses crt;
var n: longint;
begin
clrscr;
readln(n);
if n mod 2 = 0 then writeln('Chan') else writeln('Le');
readln;
end.
#include<bits/stdc++.h>
using namespace std;
long long N;
int main()
{
cin>>N;
if(N%2==0) cout<<N<<" là số chẵn";
if(N%2!=0) cout<<N<<" là số lẻ";
}
Program HOC24;
var t: longint;
a,b: integer;
function gt(x: integer): longint;
var i: integer; tich: longint;
begin
tich:=1;
for i:=1 to n tich:=tich*i;
gt:=tich;
end;
begin
write('Nhap a: '); readln(a);
write('Nhap b: '); readln(b);
t:=gt(a)+gt(b)+gt(a-b);
write('T = ',t);
readln
end.
Program HOC24;
var x,a,b: integer;
y: longint;
begiin
write('Nhap a;x;b : '); readln(a,x,b);
y:=a*x+b;
if y mod 2=0 then write('y la so le ') else write('y la so chan');
readln
end.