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.
Làm tạm :v
var n,k,i,j,dem:integer;
q,k2:Array[1..104] of integer;
C:Array[1..109] of integer;
begin
assign(input,'truyvan3.inp');
reset(input);
readln(n,k);
for i:=1 to k do read(q[i]);
close(input);
assign(output,'truyvan3.out');
rewrite(output);
for i:=1 to n do C[i]:=2*i+n;
for j:=1 to k do
begin
dem:=0;
for i:=1 to n do if C[i]=q[j] then dem:=dem+1;
k2[j]:=dem;
end;
for j:=1 to k do writeln(k2[j]);
close(output)
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,dem=0;
cin>>n;
for (int i=n; i>=1; i--)
if (n%i==0)
{
cout<<i<<" ";
dem++;
if (dem==3) break;
}
cout<<endl;
cout<<n*1<<" "<<n*2<<" "<<n*3<<endl;
}
#include <bits/stdc++.h>
using namespace std;
long long i,n,t,x,dem;
int main()
{
cin>>n;
t=0;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x>=0)
{
t=t+x;
dem++;
}
}
cout<<fixed<<setprecision(2)<<t*1.0/(dem*1.0);
return 0;
}
Câu 1:
program an_danh;
uses crt;
var tong,n,i: integer;
begin
clrscr;
tong:= 0;
write('Nhap n: ');readln(n);
for i:= 1 to n do tong:= tong + i;
write('Tong tu 1 den ',n,' = ',tong);
readln
end.
Câu 2:
program an_danh;
uses crt;
var tong,i: integer;
begin
clrscr;
tong:= 0;
for i:= 1 to 200 do
tong:= tong + i;
write('Tong 200 so nguyen dau tien: ',tong);
readln
end.
Câu 3:
program an_danh;
uses crt;
var tich:real;
i:integer;
begin
clrscr;
tich:= 1;
for i:= 1 to 30 do
tich:= tich * i;
write('Tich 30 so nguyen dau tien: ',tich:0:0);
readln
end.
Câu 4:
program an_danh;
uses crt;
var gt:real;
i,n: integer;
begin
clrscr;
write('Nhap n: ');readln(n);
gt:= 1;
for i:= 1 to n do gt:= gt * i;
write(n,'! = ',gt:0:0);
readln
end.
Câu 5:
program an_danh;
uses crt;
var x,n,i:integer;
kq:real;
begin
clrscr;
write('Nhap x: ');readln(x);
write('Nhap n: ');readln(n);
kq:= x;
for i:= 2 to n do kq:= kq * x;
write(x,' mu ',n,' = ',kq:0:0);
readln
end.
Câu 1:
uses crt;
var n,i,s:longint;
begin
clrscr;
write('n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+i;
writeln('tong S=',s);
readln;
end.
Câu 2:
uses crt;
var i,s:longint;
begin
clrscr;
s:=0;
for i:=1 to 200 do
s:=s+i;
writeln('tong 200 so nguyen dau tien la: ',s);
readln;
end.
Câu 3:
uses crt;
var i:integer;
s:real;
begin
clrscr;
s:=1;
for i:=1 to 30 do
s:=s*i;
writeln(s:4:0);
readln;
end.
Câu 4:
uses crt;
var n:qword;
i:integer;
s:real;
begin
clrscr;
write('n='); readln(n);
s:=1;
for i:=1 to n do
s:=s*i;
writeln(n,'!=',s:4:0);
readln;
end.
Câu 5:
uses crt;
var n,x,i:longint;
lt:real;
begin
clrscr;
write('co so x='); readln(x);
write('so mu n='); readln(n);
if n>=0 then
begin
lt:=1;
for i:=1 to n do
lt:=lt*x;
writeln(x,'^',n,'=',lt:4:0);
end
else writeln('vui long nhap lai so mu khong am');
readln;
end.