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.

19 tháng 5 2022

program tim_tuoi;

uses crt;

var i,j,ngaysinh,tuoi, uoctuoi,k:integer;

begin

    clrscr;

    for i:=1 to 9 do

    for j:=0 to 9 do

    for k:=0 to 9 do

    begin

    uoctuoi:=sqr(i)+sqr(j)+sqr(k);

    tuoi:=i*100+j*10+k;for ngaysinh:=1 to 31 do

    if tuoi =uoctuoi+ngaysinh then write('tuoi cua cu la: ',tuoi);

    end;

    readln;

end.

19 tháng 5 2022

hmm, bạn nên viết tham khảo nhỉ ?

19 tháng 5 2022

um

4 tháng 6 2021

program tim_tuoi;

uses crt;

var i,j,ngaysinh,tuoi, uoctuoi,k:integer;

begin

    clrscr;

    for i:=1 to 9 do

    for j:=0 to 9 do

    for k:=0 to 9 do

    begin

    uoctuoi:=sqr(i)+sqr(j)+sqr(k);

    tuoi:=i*100+j*10+k;for ngaysinh:=1 to 31 do

    if tuoi =uoctuoi+ngaysinh then write('tuoi cua cu la: ',tuoi);

    end;

    readln;

end.

18 tháng 12 2020

var lan,ha,mai:integer;

begin

    write('Tuoi Lan la ');readln(lan);

    write('Tuoi Ha la ');readln(ha);

    write('Tuoi Mai la ');readln(mai);

    write('Tong so tuoi cua ba ban la ',lan+ha+mai);

readln;

end.

7 tháng 8 2021

Uses crt;

Var m, l, h: integer;

Begin

Write('So tuoi cua Lan la: '); readln(l);

Write('So tuoi cua Ha la: ');

Readln(h);

Write('So tuoi cua Mai la: ');

Readln(m);

Writeln('Tong so tuoi cua ca ba ban la: ', m+h+l);

Readln;

End.

P/s: Chúc bạn học tốt!

 

21 tháng 3 2022

#include <bits/stdc++.h>

using namespace std;

double x,tb;

int n,i;

int main()

{

cin>>n;

tb=0;

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

{

cin>>x;

tb+=x;

}

cout<<fixed<<setprecision(2)<<tb/n;

return 0;

}

24 tháng 12 2022

??????????

20 tháng 11 2023

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

int main() {
    // Đọc dữ liệu từ tệp TUOI.INP
    std::ifstream inputFile("TUOI.INP");
    if (!inputFile.is_open()) {
        std::cerr << "Không thể mở tệp TUOI.INP" << std::endl;
        return 1;
    }

    std::vector<int> ages;
    int age;

    while (inputFile >> age) {
        // Kiểm tra nếu tuổi nằm trong khoảng từ 1 đến 100
        if (age >= 1 && age <= 100) {
            ages.push_back(age);
        } else {
            std::cerr << "Tuổi không hợp lệ: " << age << std::endl;
        }
    }

    // Đóng tệp TUOI.INP
    inputFile.close();

    // Sắp xếp tuổi từ nhỏ đến lớn
    std::sort(ages.begin(), ages.end());

    // Ghi kết quả vào tệp TUOI.OUT
    std::ofstream outputFile("TUOI.OUT");
    if (!outputFile.is_open()) {
        std::cerr << "Không thể mở tệp TUOI.OUT" << std::endl;
        return 1;
    }

    for (int i = 0; i < ages.size(); ++i) {
        outputFile << ages[i] << " ";
    }

    // Đóng tệp TUOI.OUT
    outputFile.close();

    std::cout << "Quá trình sắp xếp và ghi kết quả hoàn tất." << std::endl;

    return 0;
}

----------------------------------------------------------------

Để sử dụng chương trình, bạn cần tạo một tệp văn bản TUOI.INP chứa tuổi của dân cư (cách nhau bởi dấu cách hoặc dấu xuống dòng). Sau khi chạy chương trình, kết quả sẽ được ghi vào tệp TUOI.OUT.

27 tháng 3 2021


program tinhtong;

uses crt;

var i, n, s: integer;

begin clrscr;

Write('N so tu nhien dau tien la: ');

readln(n);

s:=0;

i:=1;

while i<=n do begin

s:=s+i;

i:=i+1;

end;

writeln('Tong cac so la: ',s);

readln

end.

 

27 tháng 3 2021

program tinhtong;

uses crt;

var i,n,t:longint;

a:array[1..100]of longint;

begin

clrscr;

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

for i:=1 to n do 

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

t:=0;i:=1;

repeat

t:=t+i;

i:=i+1;

until i=n;

writeln('tong cua ca so tren la:',t);

writeln('trung binh cua cac so tren la:',t/n);

readln;

end.

16 tháng 12 2021

B