K
Khách

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;

double a[7],b[7],c[7],t;

int dem,i;

int main()

{

for (i=1; i<=7; i++) cin>>a[i]>>b[i];

for (i=1; i<=7; i++) c[i]=(a[i]+b[i])/2;

t=0;

dem=0;

for (i=1; i<=7; i++)

{

t+=c[i];

if (c[i]<10) dem++;

}

cout<<"Nhiet do trung binh la: "<<fixed<<setprecision(2)<<t/(7*1.0)<<endl;

cout<<"So ngay nhiet do trung binh nho hon 10 do la: "<<dem;

return 0;

}

uses crt;

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

i,n,dem:integer;

begin

clrscr;

readln(n);

for i:=1 to n do readln(a[i]);

dem:=0;

for i:=1 to n do 

  if (trunc(sqrt(a[i]))=sqrt(a[i]) then dem:=dem+1;

writeln(dem);

readln;

end.

Bài 2: 

#include <bits/stdc++.h>

using namespace std;

string st;

int d;

int main()

{

getline(cin,st);

d=st.length();

cout<<d;

return 0;

}

19 tháng 1 2022

Bài 1:

Var so,i,n,dem:integer;

Begin

Write('Nhap so luong so n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i);readln(so);

If so mod 2 = 0 then dem:=dem+1;

End;

Write('Co ',dem,' so chan');

Readln;

End.

Bài 2:

Var st:string;

Begin

Write('Nhap vao xau ki tu ');readln(st);

Write(' Xau vua nhap co do dai la ',length(st));

Readln;

End.

16 tháng 4 2023

program stringManipulation;

var
  st1, st2: string;
  countN, i: integer;

begin
  write('Nhap vao xau ki tu st1: ');
  readln(st1);
  countN := 0;
  for i := 1 to length(st1) do
  begin
    if (st1[i] = 'N') or (st1[i] = 'n') then
    begin
      countN := countN + 1;
    end;
  end;
  writeln('So ky tu N va n trong xau st1 la: ', countN);
  st2 := '';
  for i := 1 to length(st1) do
  begin
    if (st1[i] >= 'A') and (st1[i] <= 'Z') then
    begin
      st2 := st2 + st1[i];
    end;
  end;
  writeln('Cac ky tu in hoa trong xau st1 la: ', st2);
  write('Xau st1 viet theo chieu nguoc lai la: ');
  for i := length(st1) downto 1 do
  begin
    write(st1[i]);
  end;
  readln;
end.

16 tháng 4 2023

st1 = input("Nhập vào xâu kí tự: ")
count_n = 0
st2 = ""
for char in st1:
    if char == 'N' or char == 'n':
        count_n += 1
    if char.isupper():
        st2 += char

print("Số lần xuất hiện của kí tự 'N' và 'n' là:", count_n)
print("Xâu kí tự chỉ chứa kí tự in hoa là:", st2)
print("Xâu kí tự đảo ngược là:", st1[::-1])

8 tháng 4 2021

program so_sanh;

uses crt;

var a, b: string;

begin

clrscr;

write('nhap xau thu nhat: ');readln(a);

 write('nhap xau thu hai: ');readln(b);

if length(a)<length(b) then write(a) else write(b);

readln 

end.

Uses crt;

Var st1,st2:string;

D1,d2:integer;

Begin

Clrscr;

Write('nhap xau thu 1:'); readln(st1);

Write('nhap xau thu 2:'); readln(st2);

D1:=length(st1);

D2:=length(st2);

If d1<d2 then write(st1)

Else writeln(st2);

Readln;

End.

16 tháng 4 2023

Program HOC24;

var i,d1,d2: byte;

st1,st2: string[60];

begin

write('Nhap xau st1: '); readln(st1);

//---------------Câu 1-------------------

d1:=0; d2:=0;

for i:=1 to length(st1) do

begin

if st1[i]='A' then d1:=d1+1;

if st1[i]='a' then d2:=d2+1;

end;

writeln('Co ',d1,' ki tu A trong xau');

writeln('Co ',d2,' ki tu a trong xau');

//---------------------- Câu 2 --------------------

st2:='';

for i:=1 to length(st1) do if st1[i] in ['a'..'z'] then st2:=st2+st1[i];

writeln('Xau st2 la: ',st2);

//------------------------------Câu 3--------------------

for i:=1 to length(st1) do st1[i]:=upcase(st1[i]);

write('Xau st1 sau khi in hoa la: ',st1);

//--------------------------------------------------------

readln

end.

16 tháng 4 2023

Chỗ câu 1 câu 2 câu 3 là s vậy ạ