Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
09. Nguyễn Thị Mỹ Hạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
31 tháng 12 2022 lúc 0:33

Chọn C

Phạm Thế Dũng
Xem chi tiết
Minh Lệ
24 tháng 3 2023 lúc 23:51

Program HOC24;

var n: longint;

d,max: byte;

begin

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

max:=0;

while n<>0 do

begin

d:=n mod 10;

if d>max then max:=d;

n:=n div 10;

end;

write('Chu so lon nhat la: ',max);

readln

end.

Thần thú bành
Xem chi tiết
depzaivl
Xem chi tiết
Ngô Bá Hùng
3 tháng 5 2023 lúc 8:21

count_even = 0
count_odd = 0

while True:
    num = int(input("Nhap so nguyen: ")) //0 de kthuc
    if num == 0:
        break
    
    if num % 2 == 0:
        count_even += 1
    else:
        count_odd += 1

print("Số lẻ:", count_odd)
print("Số chẵn:", count_even)

phamphuc
Xem chi tiết
Kiều Vũ Linh
27 tháng 4 2023 lúc 17:56

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

i,n,x:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

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

End;

Write('x = ');readln(x);

Write('Cac so lon hon ',x,' la ');

For i:=1 to n do

If a[i] > x then write(a[i]:8);

Readln

End.

Gia Kỳ
Xem chi tiết
Minh Lệ
14 tháng 3 2023 lúc 21:27

Program HOC24;

var i,n,max: integer;

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

begin

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

i:=1; max:=-1;

while i<=n do

begin

write('Nhap so thu ',i,': '); readln(a[i]);

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

i:=i+1;

end;

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

readln

end.

Lily
Xem chi tiết
Monters 1k like
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 2 2023 lúc 15:22

#include <bits/stdc++.h>

using namespace std;

int n,i,t1=0,t2=0;

int main()

{

cin>>n;

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

{

if (i%2==0) t1+=i;

else t2+=i;

}

cout<<t1<<endl;

cout<<t2<<endl;

cout<<"hieu tuyet doi la:"<<abs(t2-t1);

}

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:
Hoàng Minh Đức
13 tháng 7 2021 lúc 16:12
Hoàng Minh Đức
13 tháng 7 2021 lúc 16:13