Những câu hỏi liên quan
duclinh
Xem chi tiết
Jun Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 11 2019 lúc 21:38

uses crt;

var diem:real;

begin

clrscr;

write('nhap diem:'); readln(diem);

if diem<5 then writeln('ban can co gang hon');

if (diem>=5) and (diem<6.5) then writeln('ban dat diem trung binh');

if (diem>=6.5) and (diem<8) then writeln('ban dat diem kha');

if diem>=8 then writeln('ban dat diem gioi');

readln;

end.

Bình luận (0)
 Khách vãng lai đã xóa
Trần Tú Quyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 3 2020 lúc 20:52

uses crt;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

write('n='); readln(n);

if (n>0) and (n<=100) then

begin

t:=0;

for i:=1 to n do

begin

write('a[',i,']='); readln(a[i]);

if (a[i] mod 2=0) or (a[i] mod 2=1) then t:=t+a[i];

end;

writeln('tong cac phan tu chan hoac le trong day la: ',t);

end

else writeln('vui long nhap lai');

readln;

end.

Bình luận (0)
 Khách vãng lai đã xóa
Nguyễn Thái Sơn
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 11 2021 lúc 0:00

#include <bits/stdc++.h>

using namespace std;

double a,b;

int main()

{

cin>>a>>b;

cout<<"a truoc khi doi la:"<<fixed<<setprecision(2)<<a<<endl;

cout<<"b truoc khi doi la:"<<fixed<<setprecision(2)<<b<<endl;

swap(a,b);

cout<<"a sau khi doi la:"<<fixed<<setprecision(2)<<a<<endl;

cout<<"b sau khi doi la:"<<fixed<<setprecision(2)<<b;

return 0;

}

Bình luận (0)
minh nguyen cong
Xem chi tiết
Minh Lệ
21 tháng 4 2019 lúc 8:45

Lời giải :

program hotrotinhoc ;

var a: array[1..32000] of integer ;

i,n,max : integer ;

begin

write('Nhap n='); readln(n);

writeln('Nhap gia tri cua cac phan tu');

for i:= 1 to n do

begin

write('a[',i,']='); readln(a[i]);

end;

max:=a[1];

for i:= 1 to n do if max<a[i] then max:=a[i];

write('So lon nhat la:',max');

readln

end.

Bình luận (0)
Dương Công Hiếu
Xem chi tiết
duong hoang ngan
Xem chi tiết
Nguyễn Trung Hiếu
3 tháng 5 2019 lúc 19:35

uses crt;
var j,tg,s,max,min,i,n:longint;
a:array[1..19] of longint;
s1:real;
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-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],' ');writeln;
for i:=1 to n do
s:=s+a[i];
s1:=s/n;
writeln(‘Gia tri trung binh cua cac phan tu la: ‘,s1:0:0);
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];
write('Phan tu lon nhat la: ',max,' ','Phan tu nho nhat la: ',min); writeln;
for i:=1 to n do
if (a[i]<>0) and (a[i] mod 2=0) then write(a[i],' ');
readln
end.

Bình luận (0)
Trần Thị Thành
Xem chi tiết
Giao Huỳnh
14 tháng 4 2017 lúc 17:00

uses crt;

var X:string;

demtu,demdc,i:word;

begin

clrscr;

write('nhap cau van X:');readln(X);

writeln('so ki tu la:',length(X));

demtu:=1;

for i:=1 to length(X)-1 do

if (X[i]<>' ') and (X[i+1]=' ') then demtu:=demtu+1;

writeln('so tu la:',demtu);

demdc:=0;

for i:=1 to length(X) do

if X[i]=' ' then demdc:=demdc+1;

writeln('so dau cach la:',demdc);

readln;

end.banhqua

Bình luận (0)
Giao Huỳnh
24 tháng 4 2017 lúc 16:06

bài này mới đúng nè bạn:

uses crt;

var X:string;

demtu,demdc,i:word;

begin

clrscr;

write('nhap cau van X:');readln(X);

writeln('so ki tu la:',length(X));

X:=X+' ';

demtu:=0;

for i:=1 to length(X)-1 do

if (X[i]<>' ') and (X[i+1]=' ') then demtu:=demtu+1;

writeln('so tu la:',demtu);

delete(X,length(X),1);

demdc:=0;

for i:=1 to length(X) do

if X[i]=' ' then demdc:=demdc+1;

writeln('so dau cach la:',demdc);

readln;

end.banhqua

Bình luận (0)
le xuan huong
Xem chi tiết