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.
Câu 1:
program Tinhtong:
var
n, i, sum: integer;
begin
write('Nhap n: ');
readln(n);
sum := 0;
for i := 2 to n do
begin
if i mod 2 = 0 then
begin
sum := sum + i;
end;
end;
writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);
readln;
end.
Câu 2:
program Tinhtong:
var
n, i, sum: integer;
begin
write('Nhap n: ');
readln(n);
sum := 0;
for i := 1 to n do
begin
if i mod 2 = 1 then
begin
sum := sum + i;
end;
end;
writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);
readln;
end.
1:
uses crt;
var n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
t:=t+i*i;
write(t);
readln;
end.
2
program bt2;
var i,n,t:integer;
begin
readln(n);
s:=0;
for i:=1 to n do
if i mod 2 = 1 then s:=s+i;
readln;
end.
Program HOC24;
var a: array[1..32000] of integer;
i,max,min,n: integer;
begin
write('Nhap so phan tu N: '); readln(N);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
max:=a[1]; min:=a[1];
for i:=1 to n do
begin
if a[i]>max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('So nho nhat la :',max);
write('So lon nhat la: ',min);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,max,min: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];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
program TongN;
var
n, i, tong: integer;
begin
tong := 0;
writeln('Nhap so nguyen duong N: ');
readln(n);
i := 0;
while i < n do
begin
i := i + 1;
tong := tong + i;
end;
writeln('Tong cac so tu 1 den ', n, ' la ', tong);
readln;
end.
Program HOC24;
var i,n,max: integer;
a: array[1..1000] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do if a[i]>max then max:=a[i];
write('So lon nhat la: ',max);
readln
end.
Câu 1:
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=1;
for i:=1 to n do
s:=s*i;
writeln(s);
readln;
end.
Câu 2:
uses crt;
var t,i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=1 to n do
t:=t+i;
writeln(t);
readln;
end.
Bài 2:
#include <bits/stdc++.h>
using namespace std;
long long x,y;
int main()
{
cin >>x>>y;
cout<<x<<" "<<y;
swap(x,y);
cout<<x<<" "<<y;
return 0;
}
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long x,n;
int main()
{
cout<<x<<n;
cout<<pow(x,n);
return 0;
}
2:
#include <bits/stdc++.h>
using namespace std;
long long x,i,n,ln;
int main()
{
ln=LLONG_MIN;
cin>>n;
for (i=1; i<=n; i++)
{
cin>>x;
ln=max(ln,x);
}
cout<<ln;
return 0;
}