Bài 1 :
uses crt;
var n,i,d,t,j,tg : integer;
a : array[1..100] of longint;
function kt(x : integer) : boolean;
var r,t : integer;
begin t:=0;
while x<>0 do begin
x:=x div 10;
t:=t+1;
end;
if t=2 then kt:=true else kt:=false;
end;
begin clrscr;
write('Nhap n :'); readln(n);
d:=0;
for i:=1 to n do begin
write('Nhap a[',i,']='); readln(a[i]);
end;
for i:=1 to n do t:=t+a[i];
writeln(t);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then begin tg:=a[i];a[i]:=a[j];a[j]:=tg; end;
for i:=1 to n do write(a[i]:3);
writeln;
for i:=1 to n do if (kt(a[i])=true) and (a[i] mod 2 =0) then write(a[i]:3);
readln
end.
Bài 2 :
uses crt;
var n,i,d,t,j,tg,x : integer;
a : array[1..100] of longint;
begin clrscr;
write('Nhap so X:'); readln(x);
write('Nhap n :'); readln(n);
d:=0;
for i:=1 to n do begin
write('Nhap a[',i,']='); readln(a[i]);
end;
for i:=1 to n do write(a[i]:3);
writeln;
for i:=1 to n do if a[i] mod 2 = 0 then write(a[i]:3);
for i:=1 to n do if a[i]+a[i+1] = X then write(a[i],a[i+1]:3);
readln
end.
1.
#include <iostream>
using namespace std;
int main()
{
float tbc=0;
int n,be=0,lon=0;
cin>>n;
for(int i=0;i<n;i++){
if(be>i){
be=i;
}
if(lon<i){
lon=i;
}
tbc+=i;
}
cout<<lon<<" "<<be<<endl<<tbc/(float)n<<endl;
for(int i=n-1;i>=0;i--){
cout<<i<<" ";
}
//samon247
return 0;
}
2.
//cau nay dong 2 phai la 24 vi 11-(-13)=24
#include <iostream>
using namespace std;
void hoanvi(int &a, int &b)
{
int temp=a;
a=b;
b=temp;
}
int main()
{
int n,lon=0,be=0;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
if(i==0){
lon=arr[0];
}
if(be>arr[i]){
be=arr[i];
}
if(lon<arr[i]){
lon=arr[i];
}
}
for(int i=0;i<n;i++){
cout<<arr[i]<<" ";
}
cout<<"\n"<<lon-be<<endl;
int s=n/2,a=0,b=n-1;
if(n%2!=0){
while(a<n/2&&b>n/2){
hoanvi(arr[a],arr[b]);
a++;
b--;
}
}
else{
while(a<n/2&&b>=n/2){
hoanvi(arr[a],arr[b]);
a++;
b--;
}
}
for(int i=0;i<n;i++){
cout<<arr[i]<<" ";
}
//samon247
return 0;
}
3.
#include <iostream>
using namespace std;
string nguocxau(string s)
{
string t="";
for(int i=s.size()-1;i>=0;i--){
t+=s[i];
}
return t;
}
int main()
{
string s;
getline(cin,s);
if(nguocxau(s)==s){
cout<<"1";
}
else{
cout<<"-1";
}
//samon247
return 0;
}
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 7 - Năm thứ hai ở cấp trung học cơ sở, một cuồng quay mới lại đến vẫn bước tiếp trên đường đời học sinh. Học tập vẫn là nhiệm vụ chính!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK