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
Lê thị anh thư
Xem chi tiết
32.Thuỳ 7/2
Xem chi tiết
Nguyễn Hoàng Duy
13 tháng 3 2023 lúc 22:56

1.

Var i ,n : integer;

S , T : real;

Begin

Write ('n:') ;

Read (n) ;

S:= 0;

T:= 1;

For i:= 1 to n do

S:= S + i;

T:= T * i;

Writeln (' Tong cua ' ,n,' , S );

Writeln (' Tich của ' ,n,', T );

Readln;

End.

Nguyễn Hoàng Duy
13 tháng 3 2023 lúc 23:02

2.

program SumAndProductOfNumbers;

var
  n, m, i, sum, product: integer;

begin
  writeln('Enter the values of n and m: ');
  readln(n, m);
  
  sum := 0;
  product := 1;
  
  for i := n to m do
  begin
    sum := sum + i;
    product := product * i;
  end;
  
  writeln('The sum of numbers from ', n, ' to ', m, ' is: ', sum);
  writeln('The product of numbers from ', n, ' to ', m, ' is: ', product);
end.

Nguyễn Hoàng Duy
13 tháng 3 2023 lúc 23:03

3.

program SumAndProductOfNumbers;

var
  i, sum, product: integer;

begin
  sum := 0;
  product := 1;
  
  for i := 10 to 25 do
  begin
    sum := sum + i;
    product := product * i;
  end;
  
  writeln('The sum of numbers from 10 to 25 is: ', sum);
  writeln('The product of numbers from 10 to 25 is: ', product);
end.

NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:23

Bài 1

Var s,i:integer;

tb:real;

Begin

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

i:=1;

s:=0;

While i<=n do

Begin

s:=s+i;

i:=i+1;

End;

tb:=s/n;

Writeln('Tong la ',s);

Write('Trung binh la ',tb:10:2);

Readln;

End.

Kiều Vũ Linh
23 tháng 2 2023 lúc 11:27

Bài 2

Var i,n,souoc:integer;

Begin

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

i:=1;

While i <= n do

Begin

i:=i + 1;

If n mod i = 0 then souoc:=souoc + 1;

End;

If souoc = 1 then write(n,' la so nguyen to')

Else write(n,' khong la so nguyen to');

Readln;

End.

09 Lê Quang HIếu
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 21:34

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x<0) t+=x;

}

cout<<t;

return 0;

}

Minh Thư
Xem chi tiết
Ngô Bá Hùng
15 tháng 4 2023 lúc 17:19

def sum_and_diff(m, n):
    sum = m + n
    diff = m - n
    return sum, diff

# sử dụng chương trình con
a = 5.6
b = 2.3
result = sum_and_diff(a, b)
print("Tổng và hiệu của", a, "và", b, "là", result)

Nguyễn Thuỳ Dung
Xem chi tiết
Trần Ái Linh
8 tháng 5 2021 lúc 23:57

program im_14424;

uses crt;

var A: array[1..1000000] of longint;

S: longint;

i: integer;

begin

clrscr;

write('Nhap vao n: ');

readln(n);

S:=0;

for i:=1 to n do

begin

write('Nhap phan tu thu`,i,':');

readln(A[i]);

S:=S+i;

end;

readln

end.

Uchiha Obito
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 5 2021 lúc 19:59

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

for i:=1 to n do 

 if a[i]>0 then t:=t+a[i];

writeln(t);

readln;

end.

Duy
Xem chi tiết
Ma Phan Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 2 2021 lúc 17:02

Câu 1: 

uses crt;

var s,i:integer;

begin

clrscr;

s:=0;

for i:=1 to 10 do 

  s:=s+i;

writeln('Tong cua 10 so tu nhien dau tien la: ',s);

readln;

end.

Câu 2: 

uses crt;

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

i,n,dem:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

dem:=0;

for i:=1 to n do

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

writeln('So luong phan tu duong la: ',dem);

readln;

end.

Câu 3: 

uses crt;

var i,j:integer;

begin

clrscr;

for i:=1 to 9 do 

  begin

      writeln('Bang nhan ',i,' la: ');

for j:=1 to 10 do 

  writeln(i,'*',j,'=',i*j);

delay(200);

end;

readln;

end.

Huỳnh Thanh Trúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 5 2021 lúc 9:59

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

t:=0;

for i:=1 to n do 

  if a[i]<0 then t:=t+a[i];

writeln(t);

readln;

end.