Những câu hỏi liên quan
chickendanceneverdie
Xem chi tiết
Hello1234
Xem chi tiết
Minh Hiếu
8 tháng 9 2021 lúc 6:40

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

Bình luận (1)
Minh Hiếu
8 tháng 9 2021 lúc 6:41

#include <iostream>
using namespace std;
int main()
{
    int t,m,n,ucln;
    cout<<"Nhap n="; cin>>n;
    cout<<"Nhap m="; cin>>m;
    t=m%n;
    while (t!=0)
    {
        t=n%m;
        n=m;
        m=t;
    }
    ucln=n;
    cout<<ucln;
    return 0;
}

Bình luận (1)
Nguyễn Lê Phước Thịnh
8 tháng 9 2021 lúc 23:19

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

Bình luận (0)
phamthiminhanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 20:42

Bài 1:

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

for i:=1 to n do 

 if i mod 6=0 then s:=s+i;

writeln(s);

readln;

end.

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

Bài 2: 

uses crt;

var a,b,c,ucln,i:integer;

begin

clrscr;

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

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

write('c='); readln(c);

while a<>b do 

  begin

if a>b then a:=a-b

else b:=b-a;

end;

ucln:=a;

while ucln<>c do 

 begin

if ucln>c then ucln:=ucln-c

else c:=c-ucln;

end;

writeln(ucln);

readln;

end.

Bình luận (0)
Yoriichi_Tsugikuni ( ɻɛɑ...
11 tháng 6 2021 lúc 14:55

Scratch hay java

Bình luận (0)
 Khách vãng lai đã xóa
Hello1234
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 9 2021 lúc 2:00

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

 

Bình luận (0)
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)
Phúc Hưng 123 Lê Trần 12...
Xem chi tiết
Vũ Kiệt
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 4 2021 lúc 22:26

Câu 1: 

uses crt;

var m,n,ucln,i:integer;

begin

clrscr;

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

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

ucln:=1;

if m<n then 

begin

for i:=1 to m do 

if (m mod i=0) and (n mod i=0) then 

  begin

if ucln<i then ucln:=i;

end;

end

else begin

for i:=1 to n do 

  if (m mod i=0) and (n mod i=0) then 

begin

if ucln<i then ucln:=i;

end;

end;

writeln(ucln);

readln;

end.

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

Câu 2: 

uses crt;

var m,n,bcnn,i:integer;

begin

clrscr;

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

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

bcnn:=m*n;

for i:=m*n-1 downto 1 do 

  if (i mod m=0) and (i mod n=0) then

begin

if bcnn>i then bcnn:=i;

end;

writeln(bcnn);

readln;

end.

Bình luận (0)
Vũ Quang Vinh
31 tháng 8 2021 lúc 15:48

BCNN:

program boichung;
var m,n: word;

procedure Input;
        begin
            readln(m,n);
        end;

function BC(m,n: word): word;
var i: word;
       begin
           for i := 1 to n * m do
               if (i mod n = 0) and (i mod m = 0) then
                   write(i,' ');
       end;

begin
    Input;
    BC(m,n);
end.

UCLN:

program UCLN;
var m,n,r,i: longint;
begin
readln(n,m);

n := abs(n);
m := abs(m);

if (n = 0) then
    begin
        i := 1;
        write(m);
    end
else
    if (m = 0) then
        begin
            i := 1;
            write(n);
        end;

r := n mod m;
while r <> 0 do
      begin
        r := n mod m;
        n:= m;
        m:= r;
      end;
if (i = 0) then
    write(n);

readln    
end.

Bình luận (0)
Minh Lệ
Xem chi tiết
datcoder
14 tháng 10 2023 lúc 21:47

loading...

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)