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.
program ChuyenXauSangChuThuong;
var
str: string;
i: integer;
begin
write('Nhap mot xau ky tu: ');
readln(str);
for i := 1 to Length(str) do
str[i] := LowerCase(str[i]);
writeln('Xau ky tu chuyen thanh chu thuong la: ', str);
end.
uses crt;
var a,b,c,max:integer;
begin
clrscr;
write('nhap ba so:');readln(a,b,c);
if a mod 2=0 then writeln(a,' la so chan')
else writeln(a,'la so le);
if b mod 2=0 then writeln(b,'la so chan')
else writeln(b,'la so le');
if c mod 2=0 then writeln(c,'la so chan')
else writeln(c,'la so le');
max:=a;
if max<b then max:=b;
if max<c then max:=c;
writeln('so lon nhat trong ba so la:',max);
readln
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
string st;
int d,i,dem=0;
getline(cin,st);
d=st.length();
for (int i=0; i<d; i++)
if (st[i]=' ') dem++;
cout<<dem+1;
return 0;
}
program Tim_So_Le_Chia_Het_Cho_3;
uses crt;
var
n, i, count: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
writeln('Cac so le chia het cho 3 nho hon ', n, ' la: ');
count := 0;
for i := 1 to n do
begin
if (i mod 2 = 1) and (i mod 3 = 0) then
begin
writeln(i);
count := count + 1;
end;
end;
writeln('Co tat ca ', count, ' so le chia het cho 3');
readln;
end.
uses crt;
var a,b:array[1..100]of integer;
i,n,max,dem,j,kt,dem1,sct:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=1;
b[1]:=a[1];
for i:=1 to n do
begin
kt:=0;
for j:=1 to dem do
if b[j]=a[i] then kt:=1;
if kt=0 then
begin
inc(dem);
b[dem]:=a[i];
end;
end;
max:=0;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to n do
if b[i]=a[j] then inc(dem1);
if max<dem1 then
begin
max:=dem1;
sct:=b[i];
end;
end;
writeln('So xuat hien nhieu nhat la: ',sct);
writeln('So lan xuat hien la: ',max);
readln;
end.
Tư tưởng: Sort mảng a tăng dần, khi đó các phần tử giống nhau sẽ nằm cạnh nhau, rồi ta duyệt từ đầu đến cuối và đêm.
Code (C++): https://gist.github.com/minotour4869/7421de6e4c0ba475babc5c52c3a13728
Chúc bạn học tốt nha😉.
program tinhtong;
uses crt;
var i, n, s: integer;
begin clrscr;
Write('N so tu nhien dau tien la: ');
readln(n);
s:=0;
i:=1;
while i<=n do begin
s:=s+i;
i:=i+1;
end;
writeln('Tong cac so la: ',s);
readln
end.
giúp mình câu này luôn nhé
In ra màn hình trung bình của cấc số đã cho ở trên.
liên quan bài trên