Những câu hỏi liên quan
Đinh Hoàng Nhất Quyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 8 2023 lúc 20:02

uses crt;

var st:string;

d,i,n:integer;

begin

clrscr;

readln(n);

str(n,st);

d:=length(st);

for i:=d downto 1 do

write(st[i]);

readln;

end.

Bình luận (0)
Hiếu Nguyễn
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 17:07

Program HOC24;

var n: integer;

i: byte;

begin

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

write('So dao nguoc la: ');

while n<>0 do

begin

write(n mod 10);

n:=n div 10;

end;

readln

end.

Bình luận (0)
Vũ Kiệt
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2021 lúc 20:41

Cái này mình viết chương trình chính thôi, bạn tự viết ctc nhé

Câu 1: 

uses crt;

var n,i,s:longint;

begin

clrscr;

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

s:=1;

for i:=1 to n do

 s:=s*i;

writeln(s);

readln;

end.

Bình luận (1)
Nguyễn Lê Phước Thịnh
20 tháng 4 2021 lúc 20:42

Câu 2: 

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=d downto 1 do 

  write(st[i]);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
20 tháng 4 2021 lúc 20:42

Câu 3: 

uses crt;

var n:integer;

st:string;

begin

clrscr;

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

str(n,st);

writeln('So ',n,' co ',length(st),' chu so');

readln;

end.

Bình luận (0)
Hoàng Phượng
Xem chi tiết

#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>s;
reverse(s.begin(),s.end());
cout<<s;
return 0;
}

 

Bình luận (0)
ahihi bảo
Xem chi tiết
Anh Phạm
23 tháng 4 2021 lúc 21:36

var a: array[1..100] of integer;

       i,n:integer;

begin 

writeln('nhap n: '); readln(n);

for i:=1 to n do

begin 

readln(a[i]);

end;

for i:=1 to n do

begin 

if a[i]=1 then write(1)

else 

write('1','/',a[i],' ');

writeln;

end;

readln

end.

 

Bình luận (0)
Nguyễn Lê Phước Thịnh
23 tháng 4 2021 lúc 22:29

uses crt;

var a:array[1..100]of integer;

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

for i:=n downto 1 do 

  write(a[i]:4);

readln;

end.

Bình luận (0)
vu anh tu
Xem chi tiết
Phía sau một cô gái
21 tháng 3 2023 lúc 19:38

n = int(input("Nhập vào một số nguyên dương: "))

if n < 0:

     print(n, "là số âm")

elif n > 0:

     print(n, "là số dương")

else:

     print(n, "là số 0")

Bình luận (0)
Linh Đan
Xem chi tiết
Võ Đức Dũng
17 tháng 9 2021 lúc 21:33

câu 1

Program Nguyen_to;

Var n,i:integer;

Function NT(n:integer):Boolean;

Var ok: Boolean;

i: integer;

Begin ok:=true;

for i:=2 to n-1 do if (n mod i)= 0 then ok:=ok and false;

if n < 2 then NT:=false else NT:=ok;

End;

Begin Write('Nhap n: ');

Readln(n); i:=n;

Repeat i:=i+1;

Until NT(i);

Write('So nguyen to nho nhat lon hon ',n, 'la: ',i);

Readln End.

Bình luận (1)
Võ Đức Dũng
17 tháng 9 2021 lúc 21:39

câu 2

uses crt;

const so: set of char=['0','1','2','3','4','5','6','7','8','9'];

var a:array[1..100] of integer;

st,b:string;

c,l,i,n,j:integer;

s, Max: integer;

begin clrscr;

write('Nhap xau:');

readln(st);

l:=length(st);

i:=1;

n:=0;

repeat if (st[i] in so) then begin b:=''

repeat b:=b+st[i];

inc(i);

until (not(st[i] in so)) or (i>l);

inc(n);

val(b,a[n],c);

end;

inc(i);

until i>l;

Max:=a[1];

for i:=2 to n do If Max<A[i] Then Max:=A[i];

Writeln('Phan tu lon nhat cua mang:', Max);

readln;

end.

Bình luận (0)
lê chí hiếu
Xem chi tiết
Minh Lệ
22 tháng 8 2019 lúc 11:04

Lời giải:

Nhập mảng phải có nhập số lượng phần tử nữa bạn nhé.

program hotrotinhoc;

const fi='bai5.inp';

fo='bai5.out';

var f: text;

i,j,n,max,max1,max2,max3,max4: longint;

a: array[1..32000] of integer;

function dn(x: integer): integer;

var s: integer;

begin

s:=0; dn:=0;

while x<>0 do

begin

s:=s*10+(x mod 10);

x:=x div 10;

end;

dn:=s;

end;

function nt(x1: integer): boolean;

var j: integer;

begin

nt:=false;

if x1<2 then exit;

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

if x1 mod j=0 then exit;

nt:=true;

end;

function tongcs(x2: integer): integer;

var s1: integer;

begin

s1:=0;

while x2<>0 do

begin

s1:=s1+(x2 mod 10);

x2:=x2 div 10;

end;

tongcs:=s1;

end;

function ucln(x3,y: integer) : integer;

var z: integer;

begin

while y<>0 do

begin

z:=x3 mod y;

x3:=y;

y:=z;

end;

ucln:=x3;

end;

procedure ip;

begin

assign(f,fi);

reset(f);

readln(f,n);

for i:=1 to n do

read(f,a[i]);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

max:=0; max2:=0; max3:=0;

for i:=1 to n do

begin

if (dn(a[i])=a[i]) and (a[i]>max) then max:=a[i];

if dn(a[i])>max2 then max2:=dn(a[i]);

if (nt(a[i])) and (tongcs(a[i])>max3) then max3:=a[i];

end;

writeln(f,max);

for i:=1 to n do if dn(a[i])=max2 then

writeln(f,a[i]);

max4:=0;

for i:=1 to n do

for j:=i to n do

if (a[i]<>a[j]) and (ucln(a[i],a[j])>max4) then max4:=ucln(a[i],a[j]);

for i:=1 to n do

for j:=i to n do

if ucln(a[i],a[j])=max4 then writeln(f,a[i],' ',a[j]);

write(f,max3);

close(f);

end;

begin

ip;

out;

end.

Bình luận (3)
nguyễn đình anh tuấn
Xem chi tiết
Nguyễn Lê Phước Thịnh
29 tháng 10 2021 lúc 23:50

#inckude <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

t=0;

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

if (i%2==0) t=t+i;

cout<<t;

return 0;

}

Bình luận (0)
Huynh Uyen
Xem chi tiết
Minh Lệ
25 tháng 4 2023 lúc 23:22

Program HOC24;

var i,n: integer;

a: array[1..1000] of integer;

begin

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

for i:=1 to n do 

begin

write('A[',i,']=' ); readln(a[i]);

end;

for i:=n downto 1 do if a[i] mod 2=0 then write(a[i],' ');

readln

end.

Bình luận (0)