Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Phan Thu
Xem chi tiết
Hoan Lý
Xem chi tiết
Kiều Vũ Linh
10 tháng 5 2023 lúc 4:33

Câu 1:

var i,n:integer;

s:longint;

begin

Write('n = ');readln(n)

for i:=1 to n do

s:=s+2*i+1;

write('tong la: ',s);

readln

end.

Kiều Vũ Linh
10 tháng 5 2023 lúc 4:36

Câu 2

Bài 5:

Var b:array:[1..1000] of integer;

i,n,max:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(b[i]);

End;

Write('Cac phan tu am la: ');

For i:=1 to n dko

if b[i]<0 then write(b[i]:8);

writeln;

max:=b[1];

For i:=2 to n do

If b[i] > max then max:=b[i];

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

Readln

End.

Hiền Nguyễn
Xem chi tiết
Hiền Nguyễn
24 tháng 3 2021 lúc 9:08

Bạn ơi giúp mình với chiều nay mình thi rồi

 

Nguyễn Lê Phước Thịnh
24 tháng 3 2021 lúc 20:16

Câu 2: 

uses crt;

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

i,n,tb:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

tb:=0;

for i:=1 to n do 

  tb:=tb+a[i];

writeln(tb/n:4:2);

readln;

end.

Vân anh
Xem chi tiết
Phía sau một cô gái
22 tháng 4 2023 lúc 20:18

program TongChanLe;

var

     n,i, chans, les: integer; a: array[1..100] of integer;

begin

     chans := 0;

     les := 0;

     write('Nhap n: ');

     readln(n);

     for i:=1 to n do

     begin

          write('Nhap so thu ', i, ': ');

          readln(a[i]);

          if a[i] mod 2 = 0 then

               chans := chans + a[i]

          else

               les := les + a[i];

     end;

     writeln('Tong cac so chan la: ', chans);

     writeln('Tong cac so le la: ', les);

     readln;

end.

NTKL
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 1 2022 lúc 10:13

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;

}

Kiều Vũ Linh
19 tháng 1 2022 lúc 8:59

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.

Sói Channel
Xem chi tiết
Phía sau một cô gái
18 tháng 2 2023 lúc 15:07

n = int(input('Nhập n ( n < 150): '))

if n >= 150:

     print('n phải nhỏ hơn 150')

else:

     arr = [ ]

     total = 0

     # Nhập vào dãy số nguyên

     for i in range(n):

          arr.append(int(input('Nhập phần tử thứ ' + str(i+1) + ': ')))

     # In dãy vừa nhập

     print('Dãy vừa nhập là: ', end='')

     for i in range(n):

          print(arr[i], end=' ')

     # Tính tổng các phần tử lẻ

     for i in range(n):

          if arr[i] % 2 != 0:

               total += arr[i]

     print('\nTổng các phần tử lẻ là:', total)

    

Đỗ Thị Minh Ngọc
Xem chi tiết
⭐Hannie⭐
3 tháng 5 2022 lúc 21:36

Tham khảo

uses crt;
var a:array[1..500]of integer;
    n,i,t:integer;
Begin
    clrscr;
    write('n = ');readln(n);
    for i:=1 to n do
    begin 
        write('a[',i,'] = ');readln(a[i]);
        t:=t+a[i];
    end;
    write('tong = ',t);
    readln

Huy Phạm
Xem chi tiết
Kiều Vũ Linh
3 tháng 5 2023 lúc 6:12

1)

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

i,n,t:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

For i:=1 to n do

If a[i] > a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep tang dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Kiều Vũ Linh
3 tháng 5 2023 lúc 6:13

2)

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

i,n,t:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

For i:=1 to n do

If a[i] < a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep giam dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Nguyễn tiên
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 1 2022 lúc 15:09

uses crt;

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

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

begin

clrscr;

readln(n);

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

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

writeln;

t:=0;

for i:=1 to n do t:=t+a[i];

writeln(t);

t1:=0;

dem1:=0;

dem2:=0;

for i:=1 to n do 

  begin

if a[i]>0 then dem1:=dem+1;

if a[i] mod 2=0 then 

begin

dem2:=dem2+1;

t1:=t1+a[i];

end;

end;

writeln(dem1);

writeln(t1/dem2:4:2);

readln;

end.

zero
20 tháng 1 2022 lúc 14:08

B

Chanh Xanh
20 tháng 1 2022 lúc 14:08