Những câu hỏi liên quan
Tuấn Trần thị
Xem chi tiết
Kiều Vũ Linh
10 tháng 5 2023 lúc 17:46

Var a:array:[1..1000] of integer;

i,n,max:integer;

Begin

Write('Nhap so luong phan tu n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap diem thu ',i,' = ');readln(a[i]);

End;

Write('Cac diem vua nhap la: ');

For i:=1 to n do 

Write(a[i]:8);

writeln;

max:=a[1];

For i:=2 to n do

if a[i] > max then max:=a[i];

write('So lon nhat la ',max);

Readln

End.

Bình luận (0)
SKT_Rengar Thợ Săn Bóng...
Xem chi tiết
NgocTuan
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 3 2022 lúc 9:14

#include <bits/stdc++.h>
using namespace std;
long long a,b;
//chuongtrinhcon
long long gcd(long long a,long long b)
{
    if (b==0) return(a);
    return gcd(b,a%b);
}
//chuongtrinhchinh
int main()
{
    cin>>a>>b;
    if ((a>0 && b>0) or (a<0 && b<0)) cout<<a/gcd(a,b)<<" "<<b/gcd(a,b);
    else cout<<"-"<<-a/gcd(-a,b)<<" "<<b/gcd(-a,b);
    return 0;
}

 

Bình luận (2)
Yeu DUong nhat
Xem chi tiết
Minh Lệ
17 tháng 5 2021 lúc 21:57

Program HOC24;

var n,d,i: integer;

B: array[1..100] of integer;

t: longint;

begin

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

for i:=1 to n do 

begin

write('B[',i,']='); readln(b[i]);

end;

d:=0; t:=0;

for i:=1 to n do 

if b[i]>0 then

begin

d:=d+1;

t:=t+b[i];

end;

writeln('Tong cac so duong trong day so la: ',t);

write('Co ',d,' so duong trong day');

readln

end.

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:22

uses crt;
var b:array[1..100] of longint;
      n,i,d,s:longint;
begin
      clrscr;
      write('n='); readln(n);
      for i:=1 to n do 
            begin
                  write('a[',i,']: '); readln(b[i]);
                  if b[i]>0 then begin
                        inc(d);
                        inc(s,b[i]);
                  end;
            end;
      writeln('Tong cac so duong: ',s);
      writeln('Co ',d,' so duong');
      readln;
end.

Bình luận (0)
Minh Hào
Xem chi tiết
Hoàng Minh Đức
13 tháng 7 2021 lúc 16:11
Code:#include <stdio.h> struct phanso {int tu;int mau;}; int ucln(int a, int b) {while(a!=b){if(a>b)a=a-b;elseb=b-a;}return a;} struct phanso tg(struct phanso a) {int c = ucln(a.tu, a.mau);a.tu /= c;a.mau /= c;return a;} struct phanso tong(struct phanso a, struct phanso b) {struct phanso s;s.tu = (a.tu * b.mau) + (b.tu * a.mau);s.mau = a.mau * b.mau;return s;} main() {struct phanso ps[100];struct phanso s;int n, x = 0, maxnum;double gtps[100], max;unsigned int i;printf("Nhap n: "); scanf("%d", &n);for (i = 0; i < n; i++) {printf("Nhap tu so cua phan so so %d: ", i + 1); scanf("%d", &ps[i].tu);printf("Nhap mau so cua phan so so %d: ", i + 1); scanf("%d", &ps[i].mau);}s = ps[0];for (i = 1; i < n; i++) {s = tong(s, ps[i]);}printf("\n");printf("a) Tong: %d/%d\n", tg(s).tu, tg(s).mau);for (i = 0; i < n; i++) {if (ps[i].mau != tg(ps[i]).mau) {x += 1;}}printf("b) So phan so chua toi gian: %d\n", x);for (i = 0; i < n; i++) {gtps[i] = (double)ps[i].tu / (double)ps[i].mau;}max = gtps[0];for (i = 1; i < n; i++) {if (max < gtps[i]) {maxnum = i;max = gtps[i];}}printf("c) Phan so co gia tri lon nhat la: %d/%d", ps[maxnum].tu, ps[maxnum].mau);return 0;} Ảnh:
Bình luận (0)
Hoàng Minh Đức
13 tháng 7 2021 lúc 16:12
Bình luận (0)
Hoàng Minh Đức
13 tháng 7 2021 lúc 16:13

Bình luận (0)
nuinuini
Xem chi tiết
....
22 tháng 10 2021 lúc 8:53

uses crt;

var i:integer;

begin

clrscr;

for i:=0 to 9999 do 

  if trunc(sqrt(i))=sqrt(i) then write(i:4);

readln;

end.

Bình luận (0)
Nguyen Tu
Xem chi tiết
Hoshimiya Akari
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:15

Bài 1: 

uses crt;

var m,n,i,t:integer;

begin

clrscr;

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

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

t:=0;

for i:=m to n do 

  t:=t+i;

writeln(t);

readln;

end.

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

2:

uses crt;

var n:integer;

{---------------chuong-trinh-con-kiem-tra-chan-le---------------------}

function ktcl(x:integer):boolean;

begin

if x mod 2=0 then ktcl:=true

else ktcl:=false;

end;

{--------------------chuong-trinh-con-kiem-tra-duong-am-------------------}

fucntion ktda(x:integer):boolean;

begin

if x>0 then ktda:=true

else if x<0 then ktda:=false;

end;

{--------------------chuong-trinh-chinh-------------------------}

begin

clrscr;

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

if ktcl(n)=true then writeln('Day la so chan')

else writeln('Day la so le');

if ktda(n)=true then writeln('Day la so duong')

else writeln('Day la so am');

readln;

end.

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)