Những câu hỏi liên quan
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

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

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
Pham Huynh Bao Thy
Xem chi tiết
XTN - GAMING
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2022 lúc 10:19

1:

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<a+b;

return 0;

}

2:

#include <bits/stdc++.h>

using namespace std;

double s,r;

int main()

{

cin>>r;

s=r*r*pi;

cout<<fixed<<setprecision(2)<<s;

return 0;

}

Bình luận (0)
Selena Flynn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 23:03

c1: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

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

cout<<s;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) if (i%2==0) s=s*i;

cout<<s;

return 0;

}

Bình luận (0)
Thư Uyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:05

Bài 1: 

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

inc(i);

end;

writeln('Tong cac so trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:07

Bài 2: 

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

i:=i+2;

end;

writeln('Tong cac so le trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
NgocTuan
3 tháng 1 2022 lúc 20:13

alo

Bình luận (0)
NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 2 2023 lúc 0:38

Câu 6:

uses crt;

var n,i:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

if n mod i=0 then write(i:4);

readln;

end.

5:

uses crt;

var n,i,dem:integer;

begin

clrscr;

readln(n);

dem:=0;

for i:=0 to n do

if i mod 2=1 then 

begin

write(i:4);

dem:=dem+1;

end;

writeln;

writeln(dem);

readln;

end.

Bình luận (0)
Hắc Phong
Xem chi tiết
duong nguyenvan
21 tháng 11 2017 lúc 20:31

program bai1;

uses crt;

var a,b,c,s: real;

begin

clrscr;

write('nhap so thu nhat ='); readln(a);

write('nhap so thu hai ='); readln(b);

write('nhap so thu ba ='); readln(c);

s:=a+b+c;

writeln('tong ba so a,b,c =',s:4:2);

readln;

end.

Bình luận (0)
duong nguyenvan
21 tháng 11 2017 lúc 20:33

program bai1;

uses crt;

var n: integer;

begin

clrscr;

write('nhap so n ='); readln(n);

if n mod 2 = 0 then

writeln('la so chan ') else

writeln('la so le ');

readln;

end.

Bình luận (0)
duong nguyenvan
21 tháng 11 2017 lúc 20:39

bài 3 :

B1: S <- 0 ; i<-0;

B2: i<- i+1;

B3: Nếu i <= 100 thì S:=S+i; Và quay lại B2.TRong trường hợp ngược lại thông bào kết quả rồi kết thúc thuật toán.

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

Bình luận (0)
M Ạ C H N H A
Xem chi tiết
Danh Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 7:23

Bài 1:

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if ((x<0) and (x%2!=0)) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)