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;
m:real;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (1<=n) and (n<=30000);
m:=0;
for i:=1 to n do
m:=m+sqrt(i);
writeln('m=',m:4:2);
readln;
end.
1) var a,b,c,d,h,g:integer;
begin
write('a=');readln(a);
write('b=');readln(b);
write('c=');readln(c);
write('d=');readln(d);
h:=a;
if b>h then h:=b;
if c>h then h:=c;
if d>h then h:=d;
g:=a;
if b<g then g:=b;
if c<g then g:=c;
if d<g then g:=d;
writeln(' So lon nhat trong 4 so la: ',h);
writeln(' So be nhat trong 4 so la: ',g);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++) if (i%2!=0) t+=i;
cout<<t;
return 0;
}
a)
program UCLN_va_BCNN;
uses crt;
var a,b,c,r,p:integer;
begin
clrscr;
write('nhap a,b:');readln(a,b);
if a<b then
begin
c:=a;
a:=b;
b:=c;
end;
p:=a*b;
r:=a mod b;
while r<>0 do
begin
a:=b;
b:=r;
r:=a mod b;
end;
writeln('UCLN la: ',b);
writeln('BCNN la: ',p div b);
readln;
end.
b)
program fibonaci;
uses crt;
var i,n:integer;
a:array[1..30]of integer;
begin
clrscr;
repeat
write('nhap n:');readln(n);
if (n<1)or(n>30) then writeln('so n phai lon hon hoac bang 1 va nho hon hoac bang 30:);
until (n>=1)and(n<=30);
a[1]:=1;
a[2]:=1;
for i:=3 to n do
a[i]:=a[i-1]+a[i-2];
writeln(n,' so fibonaci dau tien la:');
for i:=1 to n do
write(a[i]:3);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n,x,a[1000],dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
{
cin>>a[i];
}
dem=0;
for (i=1; i<=n; i++)
if (a[i]%2==0) dem++;
cout<<dem<<endl;
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
return 0;
}
làm c++