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.
2:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
uses crt;
var st:array[1..10]of string;
a:array[1..10]of integer;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(st[i],a[i]);
for i:=1 to n do
writeln(st[i],' ',a[i]);
readln;
end.
refer
uses crt;
var i,n:longint;
a:array[1..100] of real;
s1,s,max,min:real;
begin
clrscr;
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('Diem trung binh mon tin hoc cua ban thu ',i,' la: ');readln(a[i]);
end;
min:=a[1];max:=a[1];
for i:=2 to n do begin
if a[i]>max then max:=a[i];
if a[i]<min then min:=a[i]; end;
for i:=1 to n do
s:=s+a[i];
s1:=s/n;
writeln('So diem cao nhat la: ',max);
writeln('So diem thap nhat la: ',min);
write('Diem TB cua ca lop la: ',s1:0:1);
readln
uses crt;
var ten:array[1..50]of string;
diem:array[1..50]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap so hoc sinh:'); readln(n);
for i:=1 to n do
begin
write('Ten cua hoc sinh thu ',i,' la: '); readln(ten[i]);
write('Diem cua hoc sinh thu ',i,' la: '); readln(diem[i]);
end;
max:=0;
for i:=1 to n do
if max<diem[i] then max:=diem[i];
writeln('Diem cao nhat la: ',max);
for i:=1 to n do
if diem[i]=max then writeln(ten[i]);
readln;
end.
program Tim_so;
var
a: array of integer;
i, n, max, min: integer;
begin
write('Nhap so phan tu cua danh sach: ');
readln(n);
SetLength(a, n);
for i := 0 to n - 1 do
begin
write('Nhap gia tri phan tu thu ', i + 1, ': ');
readln(a[i]);
if (i = 0) then
begin
max := a[i];
min := a[i];
end
else
begin
if (a[i] > max) then
max := a[i];
if (a[i] < min) then
min := a[i];
end;
end;
writeln('Phan tu co gia tri lon nhat la: ', max);
writeln('Phan tu co gia tri nho nhat la: ', min);
end.
1:
uses crt;
var t,x,i,n:integer;
begin
clrscr;
t:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
t:=t+x;
end;
write(t);
readln;
end.
2:
uses crt;
var dem,x,i,n:integer;
begin
clrscr;
dem:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
if x mod 2=0 then inc(dem);
end;
write(dem);
readln;
end.
3
program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do
if i mod 2 = 1 then
write (i,' ');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout<<"Chao cac ban"<<endl;
cout<<"Minh ten la:"<<endl;
cout<<"Minh hoc lop:";
return 0;
}
program XinChao;
uses crt;
begin
Clrscr;
writeln ('Chao cac ban!');
writeln('Minh ten la Nguyen Mai Phuong ');
writeln('Minh hoc lop 8A4');
readln;
end.
đáp án nha
uses crt;
var a:array[1..100]of string;
i,n:integer;
begin
clrscr;
write('nhap so lop='); readln(n);
for i:=1 to n do
begin
write('Nhap ten lop thu ',i,'='); readln(a[i]);
end;
writeln('Danh sach cac lop 9 la: ');
for i:=1 to n do
writeln(a[i]);
readln;
end.