K
Khách

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 x,n,d,i:longint;

st,st1:string;

a:integer;

{----------------------chuong-trinh-con-tim-ucln---------------------}

function ucln(a,b:longint):longint;

var t:longint;

begin

   t:=b mod a;

   while t<>0 do

     begin

        t:=a mod b;

        a:=b;

        b:=t;

     end;

  ucln := a;

end;

{-------------------chuong-trinh-chinh-----------------}

begin

clrscr;

write('nhap x='); readln(x);

str(x,st);

d:=length(st);

st1:='';

for i:=d downto 1 do

  st1:=st1+st[i];

val(st1,n,a);

if ucln(x,n)=1 then writeln('Phai')

else writeln('khong phai');

readln;

end.

10 tháng 1 2023

PASCAL Ạ

 

 

23 tháng 10 2021

undefined

10 tháng 11 2021

k p python đâu pascal nha mà tôi làm được rồi

16 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

long long a,b,c;

bool kt;

int main()

{

cin>>a>>b>>c;

kt=false;

if (a==(b+c)/2) kt=true;

if (b==(a+c)/2) kt=true;

if (c==(b+a)/2) kt=true;

if (kt==false) cout<<"Khong lap duoc";

else cout<<"Lap duoc";

return 0;

}

12 tháng 8 2023

def kiem_tra_nguyen_to(n):

    if n < 2:

        return False

    for i in range(2, int(n ** 0.5) + 1):

        if n % i == 0:

            return False

    return True

def kiem_tra_nguyen_to_cung_nhau(m, n):

    if kiem_tra_nguyen_to(m) and kiem_tra_nguyen_to(n):

        return True

    return False

M = int(input("Nhập số M: "))

N = int(input("Nhập số N: "))

if kiem_tra_nguyen_to_cung_nhau(M, N):

    print("Hai số", M, "và", N, "là hai số nguyên tố cùng nhau.")

else:

    print("Hai số", M, "và", N, "không phải là hai số nguyên tố cùng nhau.")

21 tháng 10 2021

Program HOC24;

var n,i: integer;

t: longint;

Begin

write('Nhap N: '); readln(N);

t:=0;

for i:=1 to n do t:=t+i;

if t mod 2=0 then write('Tong la so chan') else write('Tong la so le');

readln

end.

25 tháng 10 2021

n = int(input('nhap n'))

s = 0

for i in range(0,n):

     s = s+i

print('tong cua day tu 0 den '+n+'la'+s)

if s%2 == 0:

     print('s la so chan')

else:

     print('s la so le')

 

 

     

D
datcoder
CTVVIP
22 tháng 1

Program HOC24;

var x: integer;

begin

write('Nhap so: '); readln(x);

if x div 1000=1 then write('Mot nghin ');

if x div 1000=2 then write('Hai nghin ');

if x div 1000=3 then write('Ba nghin ');

if x div 1000=4 then write('Bon nghin ');

if x div 1000=5 then write('Nam nghin ');

if x div 1000=6 then write('Sau nghin ');

if x div 1000=7 then write('Bay nghin ');

if x div 1000=8 then write('Tam nghin ');

if x div 1000=9 then write('Chin nghin ');

if x div 1000<>0 then

if x div 100=0 then write('khong tram ');

if x div 100=1 then write('mot tram ');

if x div 100=2 then write('hai tram ');

if x div 100=3 then write('ba tram ');

if x div 100=4 then write('bon tram ');

if x div 100=5 then write('nam tram ');

if x div 100=6 then write('sau tram ');

if x div 100=7 then write('bay tram ');

if x div 100=8 then write('tam tram ');

if x div 100=9 then write('chin tram ');

if (x div 1000<>0) or (x div 100<>0) then

begin

if (x div 10<>0) then

begin

if x div 10=1 then write('muoi ');

if x div 10=2 then write('hai muoi ');

if x div 10=3 then write('ba muoi ');

if x div 10=4 then write('bon muoi ');

if x div 10=5 then write('nam muoi ');

if x div 10=6 then write('sau muoi ');

if x div 10=7 then write('bay muoi ');

if x div 10=8 then write('tam muoi ');

if x div 10=9 then write('chin muoi ');

if x mod 10=1 then write('mot');

if x mod 10=2 then write('hai');

if x mod 10=3 then write('ba');

if x mod 10=4 then write('bon');

if x mod 10=5 then write('lam');

if x mod 10=6 then write('sau');

if x mod 10=7 then write('bay');

if x mod 10=8 then write('tam');

if x mod 10=9 then write('chin');

end else

begin

if x mod 10=1 then write('le mot');

if x mod 10=2 then write('le hai');

if x mod 10=3 then write('le ba');

if x mod 10=4 then write('le tu');

if x mod 10=5 then write('le nam');

if x mod 10=6 then write('le sau');

if x mod 10=7 then write('le bay');

if x mod 10=8 then write('le tam');

if x mod 10=9 then write('le chin');

end;

readln

end.

#include <bits/stdc++.h>
using namespace std;
long long n;
//chuongtrinhcon
int tongchuso(long long n)
{
    int t=0;
    while (n>0)
    {
        int x=n%10;
        t=t+x;
        n=n/10;
    }
    return(t);
}
//chuongtrinhchinh
int main()
{
   freopen("sonut.inp","r",stdin);
   freopen("sonut.out","w",stdout);
   cin>>n;
   int t=tongchuso(n);
   while (t>10)
   {
       t=tongchuso(t);
   }
   cout<<t;
   return 0;
}

 

 

uses crt;

var i,n,t,j,kt:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=2 to n do

if n mod i=0 then

begin

kt:=0;

for j:=2 to trunc(sqrt(i)) do

if i mod j=0 then kt:=1;

if kt=0 then t:=t+i;

end;

write(t);

readln;

end.

29 tháng 8 2023

cảm ơn bn đã giúp mik nhiều bn thông cảm

12 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t,dem,j;

int main()

{

cin>>n;

x=n;

t=0;

while (n>0)

{

t=t+n%10;

n=n/10;

}

cout<<t;

dem=0;

for (i=2; i<=x; i++)

{

bool kt=true;

for (j=2; j*j<=i; j++)

if (i%j==0) kt=false;

if (kt==true) dem++;

}

cout<<dem;

return 0;

}