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.

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,s,t;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

s=1;

for (i=1; i<=n; i++) s*=a[i];

cout<<s<<endl;

t=0;

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

t+=a[i];

cout<<fixed<<setprecision(2)<<(t*1.0)/(n*1.0);

return 0;

}

uses crt;

var a,b:integer;

begin

clrscr;

readln(a,b);

writeln(a+b);

writeln(a-b);

writeln(a*b);

writeln(a/b:4:2);

readln;

end.

uses crt;

var i,n,s:integer;

begin

clrscr;

readln(n);

s:=0;

for i:=1 to n do s:=s+i;

writeln(s);

readln;

end.

uses crt;

var i,n,s:integer;

begin

clrscr;

readln(n);

s:=0;

for i:=1 to n do s:=s+i;

writeln(s);

readln;

end.

Nhập:

For i:=1 to n do readln(a[i]);

Xuất:

for i:=1 to n do write(a[i]:4);

a: Thiếu chấm phẩy và thiếu chữ do

Sửa lại: 

a:=5;

while a<10 do 

a:=a+1;

b: Lỗi: Giá trị đầu lớn hơn giá trị cuối

Sửa lại:

for i:=1 to 100 do writeln('ABC');

c: Lỗi: Thừa chấm phẩy, sai chữ do

if x<5 then x:=x+1

else x:=x+1;

d: Không bị lỗi

4 tháng 4 2022

D.D

uses crt;

var i,n,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do 

  if sqrt(i)=trunc(sqrt(i)) then t:=t+i;

writeln(t);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long i,n,kt,j;

int main()

{

cin>>n;

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

{

kt=0;

for (j=2; j*j<=i; j++)

if (i%j==0) kt=1;

if (kt==0) cout<<i<<" ";

}

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long a[20],i,n;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}