K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

22 tháng 8 2019

Lời giải :

program hotrotinhoc;

var s: real;

i,n: integer;

begin

readln(n);

s:=0;

for i:=1 to n do

if n mod 2=1 then s:=s+i;

if n mod 2=0 then s:=(n+1)/2;

write(s:1:0);

readln

end.

23 tháng 8 2019

cô ơi chỗ for thiếu begin kìa cô

4 tháng 1 2017

a)

uses crt;

VAR

n, d, i: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

d : = 1;

For i: = 1 to n do

d: = d*i;

Writeln ('d=',d);

Readln;

END.

c)

uses crt;

VAR

n, i, demuoc: integer;

BEGIN

clrscr;

Writeln ('Nhap vao n='); readln (n);

demuoc: = 0;

For i: = 1 to n do

If n mod i = 0 then

demuoc : = demuoc + 1;

If demuoc = 2 then

Writeln ('n la so nguyen to')

ELSE

Writeln ('n khong phai la so nguyen to');

Readln ;

END.

Còn phần b bạn tự nghĩ nha!

Chúc bạn học tốt!

26 tháng 3 2022

var a:Array [1..100] of word;

      n,i:byte;

      S:word;

begin

 write('Nhap so so hang trong day : n = '); readln(n);

 for i:=1 to n do begin

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

                          readln(A[i]);

                         end;

S:=0;

for i:=1 to n do if A[i] mod 2 = 1 then S:=S+A[i];

if S = 0 then write('Trong day khong co so le nao nen khong tong khong ton tai') else write('Tong cac so le trong day la : S = ',S);

readln

end.

Bài 1: 

function canbac2(x:longint):real;

begin

canbac2:=sqrt(x);

end;

Bài 2: 

function tong(n:longint):longint;

var s,i:longint;

begin

s:=0;

for i:=1 to n do 

  s:=s+i;

tong:=s;

end;

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;

}

28 tháng 10 2021

program vdd;

uses crt;

var i,n: integer;

begin

clrscr;

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

for i:=1 to n do if i mod 2=1 then write(i,';');

readln

end.

13 tháng 3 2021

Program HOC24;

var m,n,i: integer;

t1,t2: longint;

begin

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

t1:=1; t2:=1;

for i:=1 to n do t1:=t1*i;

for i:=m to n do t2:=t2*i;

writeln('T1=',t1);

write('T2=',t2);

readln

end.

12 tháng 3 2021

2 tháng 6 2021

uses crt;

var i,n:integer;

s:longint;

begin 

clrscr;

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

s:=2021;

for i:=1 to n do

s:=s+i;

writeln('s=', s);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

double s,a;

int i,n;

int main()

{

cin>>a;

s=0;

n=0;

while (s<=a) 

{

n=n+1;

s=s+1/(n*1.0);

}

cout<<n;

return 0;

}

25 tháng 2 2022

Lại C,C++ tiếp