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.
Program HOC24;
var s: real;
i,n: integer;
function tong(x: integer): longint;
var j: integer;
t: longint;
begin
t:=0;
for j:=1 to x do t:=t+j;
tong:=t;
end;
function tich(s: integer): longint;
var j1: integer;
t1: longint;
begin
t1:=1;
for j1:=1 to s do t1:=t1*j1;
tich:=t1;
end;
begin
write('Nhap N : '); readln(n);
for i:=1 to n do s:=s+tong(i)/tich(i);
write('S = ',S:2:2);
readln
end.
uses crt;
var s:real;
i,n:longint;
{------------ham-tinh-giai-thua------------------------}
function gthua(x:longint):real;
var gt:real;
i:longint;
begin
gt:=1;
for i:=1 to x do
gt:=gt*i;
gthua:=gt;
end;
{-------------------chuong-trinh-con-tinh-tong---------------------}
function tong(x:longint):real;
var t:real;
i:longint;
begin
t:=0;
for i:=1 to x do
t:=t+i;
tong:=t;
end;
{------------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+(tong(i)/gthua(i));
writeln('Ket qua la: ',s:4:2);
readln;
end.
program Lam_Lui;
var S:extended;
i,n:integer;
begin
clrscr;
write('Nhap n = ');
readln(n);
S:=0;
for i:=n downto 1 do S:=sqrt(i+S);
write('Sai tự chịu: ',S);
readln;
end.
program Lam_Lui;
var S:extended;
i,n:integer;
begin
clrscr;
write('Nhap n = ');
readln(n);
S:=0;
for i:=n downto 1 do S:=sqrt(i+S);
writeln('Sai tự chịu: ',S);
readln;
end.
#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;
}
```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<int> numbers(n); std::cout << "Enter " << n << " integers: "; for (int i = 0; i < n; ++i) { std::cin >> numbers[i]; } int sumOfOdd = 0; for (int i = 0; i < n; ++i) { if (numbers[i] % 2 != 0) { sumOfOdd += numbers[i]; } } std::sort(numbers.begin(), numbers.end()); std::cout << "Sum of odd integers: " << sumOfOdd << std::endl; std::cout << "Sorted sequence: "; for (int i = 0; i < n; ++i) { std::cout << numbers[i] << " "; } std::cout << std::endl; return 0;
}
```
N = int(input())
A = 0
B = 0
So_uoc = 0
KQ = ""
for x in range(1, N):
if (x%2==0) and (x%3==0):
A += 1
if (x>0) and (N%x==0):
if (x>B):
B = x
for i in range(1, N+1):
if (N%i==0):
So_uoc += 1
if (So_uoc == 2):
KQ = "YES"
else:
KQ = "NO"
print(A)
print(B)
print(len(str(N)))
print(KQ)
(Chẳng biết đúng không đâu )
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.
Lời giải:
program hotrotinhoc;
var max,min,i,x,k: integer;
begin
write('X='); readln(x);
write('K='); readln(k);
min:=32000; max:=0;
for i:=1 to x do if (x mod i=0) then
begin
(min>i) then min:=i;
if (max<i) then max:=i;
end;
writeln(min,' ',max);
write(sqr(x),' ',k-x);
readln
end.