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.

22 tháng 7 2021

uses crt;

Var i,n,dem:integer;

     a: array[1..1000] of integer;

Begin

clrscr;

Write('Nhap do dai cua day: ');readln(n);

dem:=0;

for i:= 1 to n do

  Begin

  write('So thu ',i,' = ');

  readln(a[i]);

  if a[i] mod 2 = 0 then inc(dem);

  end;

Writeln('Day so co ',dem,' so chan');

readln;

End.

6 tháng 8 2021

uses crt;

var i,n,dem:longint;a:array[1..1000]of longint;

begin

clrscr;

write('nhap so phan tu cua day:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu thu',i,'=');readln(a[i]);

end;

for i:=1 to n do if(a[i] mod 2=0)then inc(dem);

writeln('co tat ca:',dem,'so chan');

readln;

end.

 

uses crt;

var st:string;   

d,i,dem:integer;

begin

clrscr;

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

d:=length(st);

while st[1]=#32 do 

begin     

delete(st,1,1);     

d:=length(st); 

end;

while st[d]=#32 do 

begin     

delete(st,d,1);     

d:=length(st); 

end;

for i:=1 to d do 

begin     

while (st[i]=#32) and (st[i+1]=#32) do       

begin         

delete(st,i,1);         

d:=length(st);       

end; 

end;

st[1]:=upcase(st[1]);

for i:=1 to d do 

if st[i]=#32 then st[i+1]:=upcase(st[i+1]);

writeln('Ten cua ban sau khi viet dung la: ',st);

dem:=1;

for i:=1 to d do 

if st[i]=#32 then inc(dem);

writeln('So tu cua xau la: ',dem);

readln;

end.

undefined

Theo C++ nhé bạn

Codeblacks 

uses crt;

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

i,n,dem:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

repeat

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

until a[i]>0;

end;

writeln('Day so vua nhap la: ');

for i:=1 to 10 do 

  write(a[i]:4);

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then inc(dem);

writeln;

writeln('So luong so chan la: ',dem);

readln;

end.

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

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

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

  if a[i]>10 then inc(dem);

writeln('So phan tu lon hon 10 la: ',dem);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

writeln('So luong so chan la: ',dem1);

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

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

if (i mod 2=1) and (a[i] mod 2=0) then s:=s*a[i];

end;

writeln('Tong cac so o vi tri chan co gia tri le la: ',t);

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

writeln('Cac so le la: ');

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

writeln;

writeln('Cac so chan va lon hon 10 la: ');

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]>10) then write(a[i]:4);

readln;

end.

18 tháng 2 2021

Thank you

19 tháng 2 2023

Bài 1:

Program HOC24;

var i,n,d : byte;

t: integer;

begin

write('Nhap N: '); readln(n);

for i:=1 to n do 

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

for i:=1 to n do if (a[i] mod 3=0) and (a[i] mod 5=0) then

begin

d:=d+1;

t:=t+a[i];

end;

writeln('Co ',d,' phan tu la boi cua 3 va 5');

write('Tong la: ',t);

readln

end.

19 tháng 2 2023

Bài 2:

Program HOC24;

var i,n,k : byte;

begin

write('Nhap N: '); readln(n);

for i:=1 to n do 

begin

write('Nhap phan tu thu ',i,' : '); readln(a[i]);

end;

write('Nhap k: '); readln(k);

for i:=1 to n do if a[i]=k then d:=d+1;

writeln('Co ',d,' phan tu bang ',k);

Write('Cac chi so do la: ');

for i:=1 to n do if a[i]=k then write(i,' ');

readln

end.

#include <iostream>
using namespace std;
int main()
{
    int a[100][100],i,j,m,n;
    cout<<"Nhap so dong cua mang:"; cin>>n;
    cout<<"Nhap so cot cua mang:"; cin>>m;
    for (i=1; i<=n; i++)
        for (j=1; j<=m; j++)
    {
        cout<<"A["<<i<<","<<j<<"]="; cin>>a[i][j];
    }
    for (i=1; i<=n; i++)
    {
        for (j=1; j<=m; j++)
            cout<<a[i][j]<<" ";
        cout<<endl;
    }
    return 0;
}

 

24 tháng 2 2022

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

i,d1,d2:integer;

Begin

For i:=1 to 100 do

Begin

Write('Nhap phan tu thu ',i);readln(a[i]);

End;

For i:=1 to 100 do

If a[i] mod 2 = 0 then d1:=d1+1

Else d2:=d2+1;

Writeln('So phan tu chan la ',d1);

Write('So phan tu le la ',d2);

Readln;

End.

uses crt;

var n,i,a[100],dem1,dem2:integer;

begin

clrscr;

readln(n);

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

dem1:=0;

dem2:=0;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

writeln(dem1,' ',dem2);

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.

13 tháng 3 2021

Program HOC24;

var a,b,c,d,max: integer;

t: longint;

begin

write('Nhap a; b; c; d: '); readln(a,b,c,d);

t:=a+b+c+d;

writeln('Tong 4 so tren la: ',t); 

max:=a;

if max<b then max:=b;

if max<c then max:=c;

if max<d then max:=d;

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

readln

end.

*Cách khác:

uses crt;

var a,b,c,d,max:integer;

begin

clrscr;

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

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

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

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

writeln('Tong cua 4 so la: ',a+b+c+d);

max:=a;

if max<b then max:=b;

if max<c then max:=c;

if max<d then max:=d;

writeln('Gia tri lon nhat la: ',max);

readln;

end.