Những câu hỏi liên quan
M Ạ C H N H A
Xem chi tiết
M Ạ C H N H A
Xem chi tiết
M Ạ C H N H A
Xem chi tiết
Pham Huynh Bao Thy
Xem chi tiết
Duy
Xem chi tiết
phamthiminhanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 20:42

Bài 1:

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

for i:=1 to n do 

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

writeln(s);

readln;

end.

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

Bài 2: 

uses crt;

var a,b,c,ucln,i:integer;

begin

clrscr;

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

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

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

while a<>b do 

  begin

if a>b then a:=a-b

else b:=b-a;

end;

ucln:=a;

while ucln<>c do 

 begin

if ucln>c then ucln:=ucln-c

else c:=c-ucln;

end;

writeln(ucln);

readln;

end.

Bình luận (0)
Yoriichi_Tsugikuni ( ɻɛɑ...
11 tháng 6 2021 lúc 14:55

Scratch hay java

Bình luận (0)
 Khách vãng lai đã xóa
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)
Uyen
Xem chi tiết
nguyễn an phát
12 tháng 5 2021 lúc 14:30

program nhap_tinhtong;

uses crt;

type kmang=array[1..1000] of integer;

var A:kmang;

     n:integer;

{---Nhap---}

procedure nhap;

var i:integer;

begin

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

       for i:=1 to n do

              begin

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

              end;

end;

{---Tinh-tong---}

function tinh_tong(A:kmang; n:integer):integer;

var t,i:integer;

begin

       t:=0;

       for i:=1 to n do

              t:=t+A[i];

       tinh_tong:=t;

end;

{---CT-chinh---}

BEGIN

       clrscr;

       nhap;

       write('Tong cac phan tu la: ',tinh_tong(A,n));

       readln;

end.

Bình luận (0)
nguyễn an phát
12 tháng 5 2021 lúc 14:31

program nhap_tinhtong;

uses crt;

type kmang=array[1..1000] of integer;

var A:kmang;

     n:integer;

{---Nhap---}

procedure nhap;

var i:integer;

begin

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

       for i:=1 to n do

              begin

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

              end;

end;

{---Tinh-tong---}

function tinh_tong(A:kmang; n:integer):integer;

var t,i:integer;

begin

       t:=0;

       for i:=1 to n do

              t:=t+A[i];

       tinh_tong:=t;

end;

{---CT-chinh---}

BEGIN

       clrscr;

       nhap;

       write('Tong cac phan tu la: ',tinh_tong(A,n));

       readln;

end.

Bình luận (0)
Trần Vi Nam Khánh
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 12 2021 lúc 15:17

#include <bits/stdc++.h>

using namespace std;

long long n,i,t,dem;

int main()

{

cin>>n;

t=0;

dem=0;

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

if (i%3==0)

{

t=t+i;

dem++;

}

cout<<t<<endl;

cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0);

return 0;

}

Bình luận (0)