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.

18 tháng 4 2021

program tim_uoc;

uses crt;

var i,n,tong:integer;

begin

clrscr;

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

i:=1;tong:=0;

writeln('cac uoc cua ',n,' la:');

while i<=n do

if n mod i=0 then

begin

write(i:3);

inc(i);

end;

writeln;

i:=1;writeln('cac uoc chan:');

while i<=n do

begin

if n mod i=0 then 

begin

if i mod 2=0 then write(i:3);

tong:=tong+i;

end;

end;

writeln;

write('tong cac uoc chan:',tong);

readln;

end.

uses crt;

var n,i,t:integer;

begin

clrscr;

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

i:=1;

writeln('Cac uoc cua ',n,' la: ');

while i<=n do

  begin

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

i:=i+1;

end;

writeln;

writeln('Cac uoc chan cua ',n,' la: ');

t:=0;

i:=1;

while i<=n do 

  begin

if (n mod i=0) then

begin

t:=t+i;

write(i:4);

end;

inc(i);

end;

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

readln;

end.

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à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.

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;

i:=1;

while i<=n do 
  begin

t:=t+a[i];

inc(i);

end;

writeln(t/n:4:2);

readln;

end.

7 tháng 3 2023

Program HOC24;

var i,n: integer;

S: longint;

begin

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

i:=2; s:=0;

while i<=n do

begin

s:=s+i;

i:=i+2;

end;

write('S=',S);

readln

end.

19 tháng 3 2023

program TongCacSoChan;
var
    n, s, i: integer;
begin
    write('Nhap n: ');
    readln(n);
    s := 0;
    i := 2;
    while i <= n do
    begin
        s := s + i;
        i := i + 2;
    end;
    writeln('Tong cac so chan la: ', s);
    readln;
end.

 

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,t=0,i,dem=0;

cin>>n;

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

if (i%2==0)

{

t=t+i;

dem++;

}

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

return 0;

}

14 tháng 3 2023

Program HOC24;

var i,n: integer;

t: longint;

begin

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

if n<=5 then write('So vua nhap chua lon hon 15') else

begin

t:=0; i:=10;

while i<=n do

begin

t:=t+i;

i:=i+1;

end;

end;

write('Tong la: ',t);

readln

end.

21 tháng 3 2023

program DemSoChiaHetCho5;
var
  n, i, count: integer;
begin
  write('Nhap n: ');
  readln(n);
  
  i := 1;
  count := 0;
  while i <= n do
  begin
    if i mod 5 = 0 then
      count := count + 1;
    i := i + 1;
  end;
  
  writeln('Co ', count, ' so tu nhien chia het cho 5 trong khoang tu 1 den ', n);
end.

 

cảm ơn ạ

23 tháng 2 2023

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.

23 tháng 2 2023

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.