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 i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
dem:=0;
for i:=1 to n do
if i mod 2=0 then
begin
inc(dem);
write(i:4);
if dem=15 then writeln;
end;
readln;
end.
1.
Program bai1;
uses crt;
var i,n: integer;
begin
clrscr;
write('nhap so n ='); readln(n);
i:=1;
while i<=n do
begin
write(i:3,', ');
i:=i+2;
end;
readln;
end.
2.
Program bai2;
uses crt;
var i,n,nhonhat: integer;
a: array[1..100] of real;
min: real;
begin
clrscr;
write('nhap n :='); readln(n);
for i:= 1 to n do
begin
write('a[',i,'] = '); readln(a[i]);
end;
min:=a[1];
nhonhat:=1;
for i:= 2 to n do
if a[i] < min then
begin
min:=a[i];
nhonhat:=i;
end;
writeln('phan tu nho nhat la phan tu thu ' ,nhonhat);
readln;
end.
{ https://www.facebook.com/profile.php?id=100022887573679 }
1.
Program bai1;
uses crt;
var n,i: integer;
begin
clrscr;
write('nhap so n ='); readln(n);
for i := 1 to n do
if n mod i = 0 then
write(i :2 , ' , ');
readln;
end.
2.
program bai2;
uses crt;
var i,n: integer;
begin
clrscr;
write('nhap so n ='); readln(n);
for i: 1 to n do
if i mod 2 = 0 then
write(i: 3 ,',');
readln;
end.
uses crt;
var a:array[1..250]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
a)
Input: Số nguyên dương N, dãy số a1,a2,a3,...,an
Output: Tổng các số chẵn nhỏ hơn hoặc bằng N
b)
Program HOC24;
var i,n: integer;
t: longint;
a: array[1..1000] of integer;
f1,f2: text;
const fi='SONGUYEN.TXT';
fo='SOCHAN.TXT';
begin
assign(f1,fi);
assign(f2,fo);
reset(f1);
rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
for i:=1 to n do if (a[i] mod 2=0) and (a[i]<=n) then
begin
write(f2,a[i],' ');
t:=t+a[i];
end;
writeln(f2);
write(f2,t);
close(f1); close(f2);
end.
b) uses crt;
var a:array[1..100,1..100]of integer;
n,i,j:integer;
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
for j:=1 to n do
begin
write('a[',i,',',j,']='); readln(a[i,j]);
end;
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:4);
writeln;
end;
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
if (i%2==0) cout<<i<<" ";
cout<<endl;
for (i=1; i<=n; i++)
if (i%2==1) cout<<i<<" ";
cout<<endl;
}
Uses crt;
var i,n,dem:integer;
Begin
clrscr;
write('Nhap n: ');readln(n);
dem:=0;
for i:= 1 to n do
begin
if i mod 2 = 1 then
begin
write(i,' ');
inc(dem);
end;
if dem mod 15 = 0 then writeln;
end;
Readln;
End.
uses crt;
var i,n,dem:longint;
BEGIN
clrscr;
write('nhap so nguyen duong n:');readln(n);
dem:=0;
for i:=1 to n do
begin
if n mod 2 =1 do
begin
inc(dem);
write(i,' ')
if dem=15 then writeln;
end;
end;
readln;
end.
Program bai1;
uses crt;
var dem,n,i: integer;
begin
clrscr;
write('nhap n ='); readln(n);
dem:=0;
for i:= 1 to n do
if i mod 2 = 1 then
begin
write(i:3,',');
dem:= dem+1 ;
if dem mod 15 = 0 then writeln;
end;
readln;
end.