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.
Đề 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Đề 2:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
a)
program Tinh_S;
var
n, S: integer;
i: integer;
begin
write('Nhap gia tri cua n (30 <= n <= 90): ');
readln(n);
S := 0;
if (n >= 30) and (n <= 90) then
begin
for i := 1 to n do
S := S + i;
writeln('Gia tri cua bieu thuc S la: ', S);
end
else
writeln('Gia tri cua n khong hop le!');
readln;
end.
b)
program Tim_n;
var
n, S: integer;
begin
for n := 30 to 90 do
begin
S := 0;
for i := 1 to n do
S := S + i;
if S > 1000 then
begin
writeln('Gia tri cua n la: ', n);
break;
end;
end;
readln;
end.
a)program Tinh_S;
var n,s,i:longint;
begin
s := 0;
write('Nhap n (30 <= n <= 90): ');
readln(n);
for i := 1 to n do
begin
s := s + i;
end;
writeln('Tong S la: ', s);
end.
b) program Tim_N;
var n,s,i: longint;
begin
s := 0;
n := 1;
while s <= 1000 do
begin
s := s + n;
n := n + 1;
end;
writeln('Gia tri n can tim la: ', n-1);
end.
Bài 1:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 6=0 then s:=s+i;
writeln(s);
readln;
end.
Bài 2:
uses crt;
var a,b,c,ucln,i:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
while a<>b do
begin
if a>b then a:=a-b
else b:=b-a;
end;
ucln:=a;
while ucln<>c do
begin
if ucln>c then ucln:=ucln-c
else c:=c-ucln;
end;
writeln(ucln);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n;
double p;
int main()
{
cin>>n;
p=0;
for (i=1; i<=n; i++)
p=p+1/(i*1.0);
cout<<p+3*n;
return 0;
}
uses crt;
var i,n,s:integer;
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do
s:=s+i*i;
writeln(s);
readln;
end.
Var i,p:integer;
Begin
i:=0;
p:=1;
While p<=120 do
Begin
i:=i+1;
p:=p*i;
End;
Write('So can tim la ',i);
Readln;
End.