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.
```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;
}
```
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int main()
{
cin>>a>>b>>c;
if (a+c %2==0) cout<<"AC ";
if (b+c%2==0) cout<<"BC ";
if (a+b%2==0) cout<<"AB";
return 0;
}
Bước 1: nhập n
Bước 2: i←1; s←0;
Bước 3: s←s+1/(i*(i+2));
Bước 4: i←i+1;
Bước 5: nếu i<=n thì quay lại bước 3
Bước 6: xuất s
Bước 7: Kết thúc
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.
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.
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.
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
write(a[i]:4);
writeln;
for i:=1 to n do
if (a[i]+a[i+1] mod 10=0) then
begin
writeln(a[i],' ',a[i+1]);
writeln(i,' ',i+1);
end;
readln;
end.
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.