Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Lê Thái Hưng Thịnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 11 2021 lúc 0:13

#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;

}

Lê Thái Hưng Thịnh
Xem chi tiết
Nguyễn Hà Giang
13 tháng 11 2021 lúc 11:54

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

phamthiminhanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 1 2021 lúc 20:13

Câu 1: 

uses crt;

var a,b:integer;

begin

clrscr;

write('Nhap a='); readln(a);

write('Nhap b='); readln(b);

if (a>0) and (b>0) then writeln('Cung duong');

if (a<0) and (b<0) then writeln('Cung am');

if (a>0) and (b<0) then writeln('Duong am');

if (a<0) and (b>0) then writeln('Am duong');

readln;

end.

Câu 2: 

uses crt;

var a,b:integer;

begin

clrscr;

write('Nhap a='); readln(a);

write('Nhap b='); readln(b);

if (a mod 2=0) and (b mod 2=0) then writeln('Cung chan');

if (a mod 2<>0) and (b mod 2<>0) then writeln('Cung le');

if (a mod 2=0) and (b mod 2<>0) then writeln('Chan le');

if (a mod 2<>0) and (b mod 2=0) then writeln('Le chan');

readln;

end.

Nguyễn Đức Ánh
Xem chi tiết
09 Lê Quang HIếu
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 21:34

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x<0) t+=x;

}

cout<<t;

return 0;

}

Hoshimiya Akari
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:15

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.

Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:17

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.

NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:23

Bài 1

Var s,i:integer;

tb:real;

Begin

Write('Nhap n = ');readln(n);

i:=1;

s:=0;

While i<=n do

Begin

s:=s+i;

i:=i+1;

End;

tb:=s/n;

Writeln('Tong la ',s);

Write('Trung binh la ',tb:10:2);

Readln;

End.

Kiều Vũ Linh
23 tháng 2 2023 lúc 11:27

Bài 2

Var i,n,souoc:integer;

Begin

Write('Nhap n = ');readln(n);

i:=1;

While i <= n do

Begin

i:=i + 1;

If n mod i = 0 then souoc:=souoc + 1;

End;

If souoc = 1 then write(n,' la so nguyen to')

Else write(n,' khong la so nguyen to');

Readln;

End.

tiến bộc phấ
Xem chi tiết
Nguyễn Hữu Hoàng Hải Anh
Xem chi tiết