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.
uses crt;
var n,i:integer;
s:real;
//chuongtrinhcon
function gthua(n:integer):real;
var gt:real;
i:integer;
begin
gt:=1;
for i:=1 to n do
gt:=gt*i;
gthua:=gt;
end;
//chuongtrinhcon
function lthua(n,x:integer):real;
var lt:real;
i:integer;
begin
lt:=1;
for i:=1 to x do lt:=lt*x;
lthua:=lt;
end;
//chuongtrinhchinh
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do
s:=s+(lthua(i,i)/gthua(i));
writeln(s:4:2);
readln;
end.
uses crt;
var s:real;
a,i,n:integer;
begin
clrscr;
readln(a,n);
s:=1;
for i:=1 to n do
if i mod 2=0 then s:=s*(a+i);
writeln(s:0:0);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem1,dem2,t1,t2,sa,sd,vt1,vt2:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
dem1:=0;
t1:=0;
dem2:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then begin inc(dem1); t1:=t1+a[i]; end;
if a[i]<0 then begin inc(dem2); t2:=t2+a[i]; end;
end;
writeln(dem1);
writeln(dem2);
writeln(t1);
writeln(t2);
for i:=1 to n do
if a[i]>0 then
begin
sd:=a[i];
vt1:=i;
break;
end;
if (dem1=0) then writeln('Khong co so duong trong day')
else writeln('So duong dau tien la: ',sd,' vi tri la: ',vt1);
for i:=1 to n do
if a[i]<0 then
begin
sa:=a[i];
vt2:=i;
break;
end;
if (dem2=0) then writeln('Khong co so am trong day')
else writeln('So am dau tien la: ',sa,' vi tri la: ',vt2);
readln;
end.
uses crt;
const fi='dlra.txt';
var a:array[1..100]of integer;
i,n,h:integer;
f1:text;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
assign(f1,fi); rewrite(f1);
h:=0;
for i:=1 to n do
if a[i] mod 3<>0 then
begin
write(f1,a[i]:4);
h:=h-a[i];
end;
writeln(f1);
writeln(f1,h);
close(f1);
readln;
end.
1:
uses crt;
const fi='songuyen.int';
var f1:text;
i,n:integer;
a:array[1..1000]of integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(f1,a[i]:4);
close(f1);
readln;
end.
Câu 1:
#include <bits/stdc++.h>
using namespace std;
long long a,b,dem,i;
int main()
{
cin>>a>>b;
dem=0;
for (i=a; i<=b; i++)
if (i%2==0) dem++;
cout<<dem;
return 0;
}
Bạn vào việt jet hoặc nhấn link nha ;-;
https://hoc247.net/tin-hoc-11/bai-12-kieu-xau-l4211.html