Những câu hỏi liên quan
Nguyễn Tiến Đạt 8/1
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 1 2022 lúc 9:44

#include <bits/stdc++.h>

using namespace std;

long long i,s;

int main()

{

s=1;

for (i=5; i<=50; i++) s=s*i;

cout<<s;

return 0;

}

Bình luận (1)
Kiều Vũ Linh
24 tháng 1 2022 lúc 17:49

Var s,i:longint;

Begin

s:=1;

For i:=5 to 50 do

s:=s*i;

Write('Tich la ',s);

Readln;

End.

Bình luận (0)
h9iii
Xem chi tiết
Milly BLINK ARMY 97
16 tháng 9 2021 lúc 18:58
Program baitap;
Uses crt;
Var S,i : integer;
BEGIN
clrscr;
S:= 0;
For i:=1 to 50 do
S:= S+i;
Writeln (' Vay tong cua cac so tu 1 den 50 la ', S);
Readln
END.
Bình luận (1)
Minh Nguyệt Điêu
Xem chi tiết
Phía sau một cô gái
23 tháng 4 2023 lúc 22:23

program TinhTong;

var

      Tong, i: integer;

begin

      Tong := 0;

      for i := 1 to 50 do

      begin

            Tong := Tong + i;

      end;

      writeln('Tong tu 1 den 50 la: ', Tong);

      readln;

end.

Bình luận (0)
Ánh sao
Xem chi tiết
Phạm Nguyễn Hồng Anh
28 tháng 2 2021 lúc 16:45

câu 1:

uses crt;

var p,i:integer;

begin

clrscr;

p:=1;i:=1;while i<=5 do

begin

p:=p*i;i:=i+1;

end;

write(p);

readln;

end. 

bai 2:

uses crt;var p,i:integer;begin    clrscr;    p:=1; i:=0;    while i <=10 do    begin

i:=i+1;        if (i mod 2<>0) then p:=p*i;    end;    write(p);    readln;end. bai 3:

uses crt;var n,i,p:integer;begin     clrscr;     write('nhap n: ');     readln(n);     i:=1;     p:=1;     while i<=n do     begin       if i mod 2=0 then p:=p*i;       i:=i+1;     end;     write(p);     readln;end.     

 

Bình luận (3)
Nguyễn Lê Phước Thịnh
28 tháng 2 2021 lúc 19:17

*Cách khác: Dùng for

Câu 1: 

uses crt;

var p,i:longint;

begin

p:=1;

for i:=1 to 4 do 

  p:=p*i;

writeln(p);

readln;

end.

Câu 2: 

uses crt;

var i,s:longint;

begin

clrscr;

s:=1;

for i:=1 to 10 do

  if i mod 2=1 then s:=s*i;

writeln(s);

readln;

end.

Câu 3: 

uses crt;

var n,i,s:longint;

begin

clrscr;

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

s:=0;

for i:=1 to n do 

  if i mod 2=0 then s:=s+i;

writeln(s);

readln;

end.

Bình luận (1)
Minh Nguyệt Điêu
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.

Bình luận (0)
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.

Bình luận (0)
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.

Bình luận (0)
Paper43
Xem chi tiết
Pika Pika
10 tháng 5 2021 lúc 14:01

1x2x3x..x100

Bình luận (0)
Nguyễn Lê Phước Thịnh
10 tháng 5 2021 lúc 17:59

uses crt;

var i:integer;

s:real;

begin

clrscr;

s:=1;

for i:=1 to 100 do 

  s:=s*i;

writeln(s:0:0);

readln;

end.

Bình luận (0)
Trần Nam Khánh
12 tháng 5 2021 lúc 16:54

Program viet_chuong_trinh_tinh_tong;
Uses Crt; 
Var i,s:integer; 
Begin 
Clrscr; 
i:=2; 
While (i>1) and (i<=100) do 
Begin 
s:=s+i; 
i:=i+2; 
End; 
Writeln(S); 
Readln; 
End.

Bình luận (0)
Nguyến Ngọc Nguyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
22 tháng 2 2021 lúc 14:56

Bài 1:

uses crt;

var i,s:integer;

begin

clrscr;

s:=0;

for i:=10 to 50 do

  if i mod 2=0 then s:=s+i;

writeln(s);

readln;

end.

Bài 2: 

uses crt;

var a,i,n:integer;

begin

clrscr;

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

a:=0;

for i:=1 to n do

a:=a+i*(i+2);

writeln(a);

readln;

end.

Bình luận (0)
Tt_Cindy_tT
Xem chi tiết
Minh Lệ
10 tháng 5 2023 lúc 20:08

Program HOC24;

var i,n: integer;

tong,tich: longint;

begin

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

tong:=0; tich:=1;

for i:=1 to n do 

begin

tong:=tong+i;

tich:=tich*i;

end;

writeln('Tong la: ',tong);

write('Tich la: ',tich);

readln

end.

Bình luận (0)
Nguyễn Hoàng Duy
11 tháng 5 2023 lúc 22:46

program TinhTongTichTu1DenN;
var n, i: integer;
       tong, tich: longint;
begin
  tong := 0;
  tich := 1;

  write('Nhap vao n: ');
  readln(n);
  for i := 1 to n do
  begin
    tong := tong + i;
    tich := tich * i;
  end;

  writeln('Tong cac so tu 1 den ', n, ': ', tong);
  writeln('Tich cac so tu 1 den ', n, ': ', tich);

  readln;
end.

Bình luận (0)