Chuyển sang C++ với ạ:
Program Tinh_Trung_Binh;
uses crt;
Var
n,dem:Integer;
x,TB:real;
begin
clrscr;
dem:=0 ;TB:=0;
write(‘nhap so cac so can tinh n=’);realdn(n)
while dem
Chuyển sang C++ với ạ:
Program Tinh_Trung_Binh;
uses crt;
Var
n,dem:Integer;
x,TB:real;
begin
clrscr;
dem:=0 ;TB:=0;
write(‘nhap so cac so can tinh n=’);realdn(n)
while dem
#include<iostream>
using namespace std;
int main{
int so,n,t=0;
cout<<“nhap so phan tu”<<endl;
cin>>n;
for (int i=0;i<n;i++){
cout<<“nhap so thu “<<i<<endl;
cin>>so;
t+=so;
}t=t/n;
cout<<“trung binh cua day so tren la “<<t;
return 0;
}