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.

21 tháng 3 2017

1.Program solonhon;

ues crt;

var a,b:real;

begin

clrscr;

write('nhap so a:');readln(a);

write('nhap so b:');readln(b);

if a>b then writeln('a lon hon');

if b> a then write('b lon hon')

else writeln('a=b');

readln

end.

2.program solonhon;

uses crt;

var a,b,c,d:real;

begin

clrscr;

write('nhap bon so a,b,c,d:'); readln(a,b,c,d);

if (a>b) and (a>c) and (a>d) then writeln('a lon hon')

else if (b>a) and (b>c) and (b>d) then writeln('b lon hon')

else if (c>a) and (c>b) and (c>d) then writeln('c lon hon')

else if (d>a) and (d>b) and (d>c) then writeln('d lon hon')

else write('a=b=c=d');

readln

end.

19 tháng 3 2017

Program ct; USES CRT; Var n,i: Integer; A:array[1..10] of integer; Begin Clrscr; Write(' nhap n:'); Readln(n); For i:=1 to n do begin Write('A[',i,']='); Readln(A[i]); end; For i:=1 to n do Write(A[i]); Readln; End.

( Nếu đề chỉ yêu cầu là nhập 10 phần tử thì không cần khai báo n và thay n -> 10 trong câu lệnh for...do. Còn đề yêu cầu in n phần tử thì làm như trên).

24 tháng 3 2017

Cách 1

program CTNMT;

uses crt;

var n,i: longint;

A: array [1..1000] of longint;

Begin

Writeln('Hay nhap vao so hoc sinh ban muon nhap diem: ');

Readln(N);

For i:=1 to n do

begin

Writeln('Nhap diem tin cua ban thu ',n);

Readln(A[i]);

end;

Readln;

end.

(Đây chỉ là chương trình nhập vào thôi nha, muốn xuất thì dùng cậu lệnh lặp để xuất từng phần tử của mảng)

24 tháng 3 2017

Cách 2 bạn có thể thay thế bằng câu lệnh While...do cho câu For...to...do bằng câu lệnh: While i<=N do.........

17 tháng 3 2017

tính UCLN của a và b

program uoc_chung;

uses crt;

var a,b: integer;

begin

writeln('nhap a='); readln(a);

writeln('nhap b='); readln(b);

while a>b do then a:=a-b

else b:=b-a;

if a=b then write ('uoc chung lon nhat la',a)

readln;

end.

BCNN tương tự

31 tháng 12 2022

Program ucln_bcnn;
Uses crt;
Var x,y,uc,t,tamx,tamy:integer;
Begin
  Clrscr;
  Write('Nhap so nguyen duong x : '); readln(x);
  Write('Nhap so nguyen duong y : '); readln(y);
  tamx:=x;
  tamy:=y;
  t:=y mod x;
  while t<>0 do
   begin
    t:=x mod y;
    x:=y;
    y:=t;
   end;
   uc:=x;
  Writeln('- Ucln(' , tamx , ',' , tamy , ') la : ',uc );
  Writeln('- Bcnn(' , tamx , ',' , tamy , ') la : ',(tamx*tamy) div uc );
  Readln;
End.

 

16 tháng 3 2017

var i,n,tb :integer;

begin

readln(n);

tb:=0;

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

writeln(tb);

end.

18 tháng 3 2017

program CTTTB;

uses crt;

var TB,x:real; n,y: integer;

begin

Write('Hay nhap so so thuc ban can tinh TB'); Readln(n);

for y:=1 to n do

begin Write('Nhap so thu',y);Readln(x);

TB:=TB+x;

end;

TB:=TB/n;

Writeln('Trung binh cong cua',n,' so nhap vao tu ban phim la',TB);

Readln;

End.

16 tháng 3 2017

var i,n,s:integer;

begin

readln(n);

s:=0;

for i:=1 to n do s:=s+1/i;

writeln(s:3:0);

end.

16 tháng 3 2017

mình làm while do nhé, cái kia để mình tìm hiểu thêm

var S:real;

i,n:longint;

begin

writeln('n=') ; readln(n);

S:=0;

i:=1;

while (i<=n) do

begins=

S:= 9S+1/i;

i:=i+1;

end;

writeln ('S=');

end.

16 tháng 3 2017

2/ program bt;

var N,i:integer;

begin

write('nhap so N'); readln(N);

writeln;

writeln (' bang nhan ', N);

writeln;

for i:=1 to 10 do writeln(N,'x',1:2,'= ', N*1;3); end

readln

end.

Mik chỉ bít làm bài 2 thôi!

18 tháng 3 2017

program loc_so_le;

uses crt;

var N,y: longint;

begin

Writeln('Nhap so N '); Readln(N);

for y:=1 to N do if (y mod 2) <>0 then Writeln (y,' la so le');

Readln;

end.

16 tháng 3 2017

var i,n,s:integer;

A:array[1..100] ò longint;

begin

readln(n);

for i:=1 to n do

begin

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

readln(A[i]);

end;

s:=0;

for i:=1 to n do s:=s+A[i];

write(s);

s:=0;

if A[i] mod 2=0 then s:=s+A[i];

write(s);

end.

16 tháng 3 2017

bài 1

var i,n,S:longint;

begin

writeln('n=');

readln(n);

S:=0;

i:=0;

for i:=1 to n do

S:=S+n;

writeln('S=',S);

readln

end.

28 tháng 3 2017

3

a) s:= 0 while X:=10 \(\rightarrow\) X<= 10

b) thiếu câu lệnh

c) n:=1

#include <bits/stdc++.h>using namespace std;long long n,i,sd,sc,d1,d2,x,y,dem;string st1,st2;//chuongtrinhconbool ktnt(long long n){for (long i=2; i*i<=n; i++)  if (n%i==0) return(false);return true;}//chuongtrinhconlong long sdn(long long n){long long x=n;long long kq=0;while (x>0){kq=kq+x%10;x=x/10;}return kq;}int main(){cin>>n;st1='1';for (i=1; i<=n-1; i++) st1=st1+'0';st2='9';    for (i=1; i<=n-1; i++) st2=st2+'9';    sd=0;    d1=st1.length();    for (i=0; i<=d1-1; i++)    {    x=int(st1[i])-48;    sd=sd*10+x;    }    sc=0;    d2=st2.length();    for (i=0; i<=d2-1; i++)    {    y=int(st2[i])-48;    sc=sc*10+y;    }    dem=0;    for (long long j=sd; j<=sc; j++)    {    if ((ktnt(j)==true) and (ktnt(sdn(j))==true)) dem++;    }    cout<<dem;    return 0;}