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

Nguyễn Gia Viễn
Xem chi tiết
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.

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
Vu Hoang Anh
Xem chi tiết

#include <bits/stdc++.h>
using namespace std;
bool ktsnt(long long n)
{
    long long i;
if(n<2) return false;
    else
    {
        for(i=2;i<=sqrt(n);i++)
            if(n%i==0)
            return false;
        return true;
    }
}
long long cnt;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>cnt;
if(ktsnt(cnt)==true)
    cout<<"YES";
else
    cout<<"NO";
return 0;
}

 

Kiều Vũ Linh
10 tháng 2 2022 lúc 16:23

var i,n,dem:integer;

begin

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

for i:=1 to n do

begin

if n mod i = 0 then dem:=dem+1;

end;

if dem = 2 then write(n,' la so nguyen to')

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

readln;

end.

 

Nguyen Hoang Khoi
Xem chi tiết
le manh vu
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 2 2022 lúc 22:51

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[10],i;

bool kt;

int main()

{

for (i=1; i<=10; i++) cin>>a[i];

kt=true;

for (i=1; i<=9; i++) if (a[i]>a[i+1]) kt=false;

if (kt==true) cout<<"YES";

else cout<<"NO";

return 0;

}