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.
Bài 1:
program in_phan_tu;
uses crt;
var n,i:longint;
a:array[1..100] of longint;
begin
clrscr;
write('nhap so n:');readln(n);
for i:=1 to n do
begin
write('nhap phan tu a[',i,']:');readln(a[i]);
end;
for i:=1 to n do
write(a[i]:3);
readln;
end.
Bài 2:
program tong_phan_tu;
uses crt;
var n,i,tong:longint;
a:array[1..100] of longint;
begin
clrscr;
write('nhap so n:');readln(n);
for i:=1 to n do
begin
write('nhap phan tu a[',i,']:');readln(a[i]);
end;
tong:=0;
for i:=1 to n do
tong:=tong+a[i];
writeln('tong cua day la:');
readln;
end.
Bài 3:
program tong_phan_tu_chan;
uses crt;
var n,i,tong:longint;
a:array[1..100] of longint;
begin
clrscr;
write('nhap so n:');readln(n);
for i:=1 to n do
begin
write('nhap phan tu a[',i,']:');readln(a[i]);
end;
tong:=0;
for i:=1 to n do
if a[i] mod 2=0 then tong:=tong+a[i];
writeln('tong cua day la:');
readln;
end.
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
uses crt;
var i,sokm:integer;
tong:real;
begin
write('nhap so km: ');readln(sokm);
for i:=1 to n do
begin
if i=1 then tong:=tong+5000;
else if tong>=2 and tong<=5 then tong:=tong+4500;
else tong:=tong+3500;
end;
if sokm>120 then tong=(tong/10)*9;
writeln('so tien la ',tong,' dong');
readln;
end.
3:
#include <bits/stdc++.h>
using namespace std;
double x,y,z;
int main()
{
cin>>x>>y>>z;
cout<<x+y+z<<endl;
cout<<x*y*z;
return 0;
}
Bài 1:
Program HOC24;
var a: array[1..1000] of integer;
i,n,d: integer;
begin
write('Nhap so phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
for i:=1 to n do if (a[i]<0) and (a[i] mod 2=0) then d:=d+1;
write('Co ',d,' so nguyen am chan trong day so');
readln
end.
Bài 2:
Program HOC24;
var a: array[1..1000] of integer;
i,n: integer;
t: longint;
begin
write('Nhap so phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
t:=0;
for i:=1 to n do if a[i] mod 5=0 then t:=t+a[i];
write(Tong la: ',t);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
//chuongtrinhcon
long long gcd(long long a,long long b)
{
if (b==0) return(a);
return gcd(b,a%b);
}
//chuongtrinhchinh
int main()
{
cin>>a>>b;
if ((a>0 && b>0) or (a<0 && b<0)) cout<<a/gcd(a,b)<<" "<<b/gcd(a,b);
else cout<<"-"<<-a/gcd(-a,b)<<" "<<b/gcd(-a,b);
return 0;
}
bài 1;
Program bai1;
uses crt;
var tienxe: real;
a: integer;
begin
clrscr;
write('nhap so km ='); readln(a);
if a <= 1 then tienxe:=13000*a
else
if a <= 30 then tienxe:=13000*1+12000*(a-1)
else
tienxe:=13000*1+29*12000+(a-30)*11000;
writeln('so tien xe phai tra la : ' ,tienxe:9:0,'VND');
readln;
end.
Chúc bạn học tốt !
Bài 2:
Program bai2;
uses crt;
var a,b,kq: real;
pt: char;
begin
clrscr;
write('Nhap 2 so a, b: ');
readln(a,b);
writeln ('Nhap phep tinh can thuc hien: ');
readln(pt);
case pt of
'+' : kq:=a+b;
'-' : kq:=a-b;
'*' : kq:=a*b;
'/' : kq:=a/b;
end;
write('Ket qua: ',kq:0:2);
readln ;
end.