Những câu hỏi liên quan
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)
Bùi Minh Dũng
Xem chi tiết
nguyễn an phát
26 tháng 5 2021 lúc 21:13

program max_min;

uses crt;

var i,n,max,min:integer;

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

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

writeln('day vua nhap la:');

for i:=1 to n do

write(a[i]:3);

writeln;

max:=a[1];min:=a[1];

for i:=1 to n do

begin

if a[i]>max then max:=a[i];

if a[i]<min then min:=a[i];

end;

writeln('gia tri lon nhat: ',max,' gia tri nho nhat: ',min);

readln;

end.

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 20:59

uses crt;
var a:array[1..1000000] of longint;
      n,i,max,min:longint;
begin
      clrscr;
      write('Nhap so luong phan tu: '); readln(n);
      for i:=1 to n do 
            begin
                  write('Nhap phan tu thu ',i,': '); readln(a[i]);
            end;
      write('Day so vua nhap: ');
      for i:=1 to n do write(a[i],' '); writeln;
      max:=a[1];min:=a[1];
      for i:=2 to n do 
            begin
                  if a[i]>max then max:=a[i];
                  if a[i]<min then min:=a[i];
            end;
      writeln('GTLN: ',max);
      writeln('GTNN: ',min);
      readln;
end.

Bình luận (0)
Vochehoang
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 4 2021 lúc 12:11

Câu 1: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(t);

readln;

end.

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

Câu 2: 

uses crt;

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

i,n,x,dem,kt:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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

kt:=0;

dem:=0;

for i:=1 to n do 

if a[i]=x then 

begin

kt:=1;

write(i:4);

inc(dem);

end;

if kt=0 then writeln('Khong co ',x,' trong day');

writeln(x,' xuat hien ',dem,' lan trong day');

readln;

end.

Bình luận (0)
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.

Bình luận (1)
Trần Phúc Tâm
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 11 2021 lúc 23:23

#include <bits/stdc++.h>
using namespace std;
long long n,m;
//chuongtrinhcon
long long tcs(long long n)
{
    long long t=0;
    for (i=1; i<=n-1; i++)
        if (n%i==0) t=t+i;
    return(t);
}
//chuongtrinhchinh
int main()
{
    cin>>n>>m;
    if ((tcs(n)==m) and (tcs(m)==n)) cout<<"Yes";
    else cout<<"No";
}

 

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)
Nguyen Van Anh
Xem chi tiết
Võ Đức Dũng
28 tháng 10 2021 lúc 14:01

program vdd;

uses crt;

var i,n: integer;

begin

clrscr;

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

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

readln

end.

Bình luận (0)
Diễm Phạm Thị Hồng
Xem chi tiết
Diễm Phạm Thị Hồng
31 tháng 7 2023 lúc 22:25

Mn giúp e vơi e đang cần gấp!!!!!

Bình luận (0)
Bùi Minh Dũng
Xem chi tiết
nguyễn an phát
26 tháng 5 2021 lúc 21:14

program max_min;

uses crt;

var i,n:integer;

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

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

writeln('day vua nhap la:');

for i:=1 to n do

write(a[i]:3);

readln;

end.

Bình luận (0)