Những câu hỏi liên quan
Dung
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 3 2022 lúc 20:25

#include <bits/stdc++.h>

using namespace std;

long long a,b;

//chuongtrinhcon

long long ucln(long long a,long long b)

{

if (b==0) return(a);

else return(ucln(b,a%b));

}

//chuongtrinhchinh

int main()

{

cin>>a>>b;

cout<<ucln(a,b);

return 0;

}

Bình luận (0)
Hưng Quốc
Xem chi tiết
HT.Phong (9A5)
31 tháng 3 2023 lúc 16:51

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
láobốlaos
31 tháng 3 2023 lúc 16:54

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
2 tháng 4 2023 lúc 16:31

1.

program InDaySoTuNhien;
var n, i: integer;
begin
   write('Nhap so nguyen duong n: ');
   readln(n);

   writeln('Day so tu 1 den ', n, ' la:');
   for i := 1 to n do
      write(i, ' ');
end.

2.

program InSoChan;
var
   n, i: integer;
begin
   write('Nhap so nguyen n: ');
   readln(n);

   writeln('Cac so nguyen chan trong khoang tu 1 den ', n, ' la:');
   for i := 1 to n do
   begin
      if i mod 2 = 0 then
         write(i, ' ');
   end;
end.

Bình luận (0)
Nguyễn Thị Tươi
Xem chi tiết
Lê Đăng Khôi
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 2 2023 lúc 15:39

1:

uses crt;

var t,x,i,n:integer;

begin

clrscr;

t:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

t:=t+x;

end;

write(t);

readln;

end.

2: 

uses crt;

var dem,x,i,n:integer;

begin

clrscr;

dem:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

if x mod 2=0 then inc(dem);

end;

write(dem);

readln;

end.

Bình luận (1)
Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:18

3

program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do

if  i mod 2 = 1 then
write (i,' ');
readln;
end.

Bình luận (1)
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)
Nguyễn khánh thành
Xem chi tiết
Thúy Ngọc Văng Thị
Xem chi tiết
ka nekk
10 tháng 5 2022 lúc 13:00

thiếu đề?

Bình luận (1)
thư nguỹn:>>
10 tháng 5 2022 lúc 13:00

hình như thiếu đề r .-.

Bình luận (1)
phạm hương trà
Xem chi tiết
Công Chúa Sakura
4 tháng 1 2017 lúc 22:32

a)

uses crt;

VAR

n, d, i: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

d : = 1;

For i: = 1 to n do

d: = d*i;

Writeln ('d=',d);

Readln;

END.

c)

uses crt;

VAR

n, i, demuoc: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

demuoc: = 0;

For i: = 1 to n do

If n mod i = 0 then

demuoc : = demuoc + 1;

If demuoc = 2 then

Writeln ('n la so nguyen to')

ELSE

Writeln ('n khong phai la so nguyen to');

Readln ;

END.

Còn phần b bạn tự nghĩ nha!

Chúc bạn học tốt!

Bình luận (0)
Nguyễn Gia Viễn
Xem chi tiết
cao thi trang
Xem chi tiết
Rin Huỳnh
8 tháng 10 2021 lúc 21:45

Pascal, Python hay C++ bạn?

Bình luận (1)
Trương Huy Hoàng
8 tháng 10 2021 lúc 21:47

#include <iostream>
using namespace std;
int main()
{
int M, N;
cin >> M >> N;
cout << "Tong cua hai so la " << M+N << endl;
return 0;
}

Chúc bn học tốt!

Bình luận (1)