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.

D
datcoder
Giáo viên
22 tháng 1

Program HOC24;

var x: integer;

begin

write('Nhap so: '); readln(x);

if x div 1000=1 then write('Mot nghin ');

if x div 1000=2 then write('Hai nghin ');

if x div 1000=3 then write('Ba nghin ');

if x div 1000=4 then write('Bon nghin ');

if x div 1000=5 then write('Nam nghin ');

if x div 1000=6 then write('Sau nghin ');

if x div 1000=7 then write('Bay nghin ');

if x div 1000=8 then write('Tam nghin ');

if x div 1000=9 then write('Chin nghin ');

if x div 1000<>0 then

if x div 100=0 then write('khong tram ');

if x div 100=1 then write('mot tram ');

if x div 100=2 then write('hai tram ');

if x div 100=3 then write('ba tram ');

if x div 100=4 then write('bon tram ');

if x div 100=5 then write('nam tram ');

if x div 100=6 then write('sau tram ');

if x div 100=7 then write('bay tram ');

if x div 100=8 then write('tam tram ');

if x div 100=9 then write('chin tram ');

if (x div 1000<>0) or (x div 100<>0) then

begin

if (x div 10<>0) then

begin

if x div 10=1 then write('muoi ');

if x div 10=2 then write('hai muoi ');

if x div 10=3 then write('ba muoi ');

if x div 10=4 then write('bon muoi ');

if x div 10=5 then write('nam muoi ');

if x div 10=6 then write('sau muoi ');

if x div 10=7 then write('bay muoi ');

if x div 10=8 then write('tam muoi ');

if x div 10=9 then write('chin muoi ');

if x mod 10=1 then write('mot');

if x mod 10=2 then write('hai');

if x mod 10=3 then write('ba');

if x mod 10=4 then write('bon');

if x mod 10=5 then write('lam');

if x mod 10=6 then write('sau');

if x mod 10=7 then write('bay');

if x mod 10=8 then write('tam');

if x mod 10=9 then write('chin');

end else

begin

if x mod 10=1 then write('le mot');

if x mod 10=2 then write('le hai');

if x mod 10=3 then write('le ba');

if x mod 10=4 then write('le tu');

if x mod 10=5 then write('le nam');

if x mod 10=6 then write('le sau');

if x mod 10=7 then write('le bay');

if x mod 10=8 then write('le tam');

if x mod 10=9 then write('le chin');

end;

readln

end.

9 tháng 5 2023

Var a:array:[1..1000] of real;

i,n,max,min,s:real;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

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;

Write('Cac so vua nhap la ');

for i:=1 to n do write(a[i]:10:2):

Writeln;

Writeln('Tong la ',s:10:2);

Writeln('So nho nhat la ',min:10:2);

Write('So lon nhat la ',max:10:2);

Readln

End.

27 tháng 5 2023

var
  Mang: array[1..100] of Integer;
  N, i, Tong, Min, Max: Integer;

begin
  // Yêu cầu nhập độ dài của dãy số từ bàn phím
  Write('Nhap do dai cua day so: ');
  ReadLn(N);

  // Yêu cầu nhập các phần tử của dãy từ bàn phím
  for i := 1 to N do
  begin
    Write('Nhap phan tu thu ', i, ': ');
    ReadLn(Mang[i]);
  end;

  // In ra màn hình các số vừa nhập
  Write('Cac so vua nhap: ');
  for i := 1 to N do
  begin
    Write(Mang[i], ' ');
  end;
  WriteLn;

  // Tính tổng các phần tử của dãy số
  Tong := 0;
  for i := 1 to N do
  begin
    Tong := Tong + Mang[i];
  end;
  WriteLn('Tong cac phan tu cua day so la: ', Tong);

  // Tìm giá trị nhỏ nhất của dãy số
  Min := Mang[1];
  for i := 2 to N do
  begin
    if Mang[i] < Min then
      Min := Mang[i];
  end;
  WriteLn('Gia tri nho nhat cua day so la: ', Min);

  // Tìm giá trị lớn nhất của dãy số
  Max := Mang[1];
  for i := 2 to N do
  begin
    if Mang[i] > Max then
      Max := Mang[i];
  end;
  WriteLn('Gia tri lon nhat cua day so la: ', Max);

  ReadLn;
end.

#include <bits/stdc++.h>

using namespace std;

long long a,b;

char st;

int main()

{

cin>>a>>b;

cout<<"Nhap phep tinh:"; cin>>st;

if (st=='+') cout<<a+b;

if (st=='-') cout<<a-b;

if (st=='*') cout<<a*b;

if (st=='/') cout<<a/b;

return 0;

}

23 tháng 1 2022

minh tap lap trinh pascal ma du sao cung cam mon ban da co long tot

19 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

long n,i,dem,t;

int main()

{

cin>>n;

dem=0;

t=0;

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

if (n%i==0) 

{

dem++;

t=t+i;

}

cout<<dem<<" "<<t;

return 0;

}

D
datcoder
Giáo viên
4 tháng 11 2023

Program HOC24;

var a,b,c,max: integer;

begin

readln(a,b,c);

max=a;

if max>b then max=b;

if max>c then max=c;

write('So lon nhat trong 3 so la: ',max);

readln;

end.

13 tháng 6 2023

program abcdef;

uses Crt;

var

k, lowerLimit, upperLimit, i, j, reversed, temp, remainder: integer;

isPrime, isPalindrome: boolean; 

begin

clrscr;

write('Nhap so chu so k (1<=k<=9): ');

readln(k);

 lowerLimit := 1;

for i := 1 to k - 1 do

lowerLimit := lowerLimit * 10; 

upperLimit := lowerLimit * 10 - 1; 

writeln('Cac so nguyen to doi xung co ', k, ' chu so la:');

for i := lowerLimit to upperLimit do

begin

// Kiểm tra số nguyên tố

isPrime := True;

if i < 2 then

isPrime := False

else

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

if i mod j = 0 then

beginisPrime := False;break;end;

// Kiểm tra số đối xứng

if isPrime then

begin

reversed := 0;

temp := i;

while temp <> 0 dobeginremainder := temp mod 10;

reversed := reversed * 10 + remainder;

temp := temp div 10;

end;

isPalindrome := (i = reversed);

 if isPalindrome then

writeln(i);

end;

end; 

readln;

end.

6 tháng 9 2021

Program HOC24;

var i,n: integer;

t: longint;

begin

read(n);

t:=n;

if n<>0 then

begin

while n<>0 do

begin

read(n);

t:=t+n;

end;

end;

readln;

readln

end.

Cách khác:

uses crt;

var n,t:integer;

begin

clrscr;

t:=0;

repeat

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

t:=t+n;

until n=0;

writeln(t);

readln;

end.

1 tháng 7 2023

```cpp
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
int n;
std::cout << "Enter the number of integers (n < 10^5): ";
std::cin >> n;

std::vector&lt;int&gt; numbers(n); std::cout &lt;&lt; &quot;Enter &quot; &lt;&lt; n &lt;&lt; &quot; integers: &quot;; for (int i = 0; i &lt; n; ++i) { std::cin &gt;&gt; numbers[i]; } int sumOfOdd = 0; for (int i = 0; i &lt; n; ++i) { if (numbers[i] % 2 != 0) { sumOfOdd += numbers[i]; } } std::sort(numbers.begin(), numbers.end()); std::cout &lt;&lt; &quot;Sum of odd integers: &quot; &lt;&lt; sumOfOdd &lt;&lt; std::endl; std::cout &lt;&lt; &quot;Sorted sequence: &quot;; for (int i = 0; i &lt; n; ++i) { std::cout &lt;&lt; numbers[i] &lt;&lt; &quot; &quot;; } std::cout &lt;&lt; std::endl; return 0;

}
```

uses crt;

var n,i,dem,j,t:integer;

kt:boolean;

begin

clrscr;

readln(n);

t:=0;

for i:=2 to n do 

begin

kt:=true;

for j:=2 to i-1 do 

  if i mod j=0 then kt:=false;

if kt=true then 

begin

write(i:4);

t:=t+i;

end;

end;

writeln;

writeln(t);

readln;

end.