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.
#include <bits/stdc++.h>
using namespace std;
int n,k,a,b;
int main()
{
cin>>n>>k;
a=(n+k)/2;
b=(n-k)/2;
cout<<"So hoc sinh nam la: "<<a;
cout<<"\nSo hoc sinh nu la: "<<b;
Return 0;
}
Uses crt;
Var i,n:integer;
a:array[1..1000] of integer;
Begin
clrscr;
Write('Nhap so hoc sinh: ');readln(n);
Writeln('Nhap diem hoc ki mon tin cua ',n,' em hoc sinh:');
For i:=1 to n do
Begin
Write('Hoc sinh thu ',i,' : ');
readln(a[i]);
End;
Writeln('Diem kiem tra cua ',n,' em hoc sinh vua nhap la:');
For i:= 1 to n do writeln('Hoc sinh thu ',i,' : ',a[i]);
readln;
End.
a)
var a:array[1..100] of longint;
n,i,max,d:longint;
begin
read(n);
for i:=1 to n do
write('nhap chieu cao, don vi cm');read(a[i]);
b) max:=a[1];
for i:=2 to n do
if a[i]>max then max:=a[i];
writeln('ban cao nhat cao',max);
c) for i:=1 to n do
if a[i]>160 then d:=d+1;
write('so ban cao hon 160 cm la: ',d);
end.
Câu 4:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);
writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);
readln;
end.
Câu 5:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
readln;
end.
2:
#include <bits/stdc++.h>
using namespace std;
double a;
int main()
{
cin>>a;
cout<<a*a;
return 0;
}
Program HOC24;
var i,d: integer;
a: array[1..6] of real;
begin
for i:=1 to 6 do
begin
write('Nhap diem cua ban thu ',i,': '); readln(a[i]);
end;
write('Diem trung binh tren 6.5 la: ');
for i:=1 to 6 do if a[i]>6.5 then write(a[i]:1:1,' ');
writeln;
d:=0;
for i:=1 to 6 do if a[i]<5 then d:=d+1;
write('Co ',d,' ban it hon 5 diem');
readln
end.
uses crt;
var a:array[1..6]of integer;
i,dem:integer;
begin
clrscr;
for i:=1 to 6 do
begin
write('Nhap diem cua ban thu ',i,' la: '); readln(a[i]);
end;
for i:=1 to 6 do
if a[i]>6.5 then write(a[i]:4);
writeln;
dem:=0;
for i:=1 to 6 do
if a[i]<5 then inc(dem);
writeln(dem);
readln;
end.
var a,b,C : integer ;
begin
wirte('nhap so hoc sinh nam'); readln(a);
wirte('nhap so hoc sinh nu'); readln(b);
If a>b then writeln('nam nhieu hon nu') else writeln('nu nhieu hon nam');
begin
C:=a-b;
C:=b-a
end;
write('hon nhau so ban la',C);
readln
end.
program bai1;
var x,y:longint;
begin
write('So hs nam: ');readln(x);
write('So hs nu: ');realn(y);
if x<y then write('Nam it hon nu (it hon ',y-x,' hs')
else if x>y then write('Nam nhieu hon nu (nhieu hon ',x-y,' hs')
else if x=y then write('Nam=nu ');
readln
end.