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.
2:
#include <bits/stdc++.h>
using namespace std;
int main()
{
string st;
int d,i;
getline(cin,st);
d=st.length();
for(i=d-1; i>=0; i--)
cout<<st[i];
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
freopen("songuyen.inp","r",stdin);
freopen("ketqua.out","w",stdout);
cin>>a>>b;
cout<<a+b<<endl;
cout<<a-b<<endl;
cout<<a*b<<endl;
cout<<a/b;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int N, sum = 0, num;
float average;
cout << "Nhap so phan tu cua day: ";
cin >> N;
// Vòng lặp để nhập dữ liệu cho các phần tử trong dãy
for (int i = 0; i < N; i++) {
cout << "Nhap phan tu thu " << i+1 << ": ";
cin >> num;
sum += num; // tính tổng của dãy
}
// tính trung bình cộng của dãy
average = (float) sum / N;
cout << "Trung binh cong cua day la: " << average;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,k;
cin>>a>>b>>k;
for (int i=a; i<=b; i++)
if (i%k==0) cout<<i<<" ";
return 0;
}
uses crt;
var st:string;
i,d,dem:integer;
b:char;
begin
clrscr;
write('Nhap xau st:'); readln(st);
d:=length(st);
write('Nhap ki tu b:'); readln(b);
dem:=0;
for i:=1 to d do
if b=st[i] then inc(dem);
writeln(dem);
readln;
end.
Bạn vào việt jet hoặc nhấn link nha ;-;
https://hoc247.net/tin-hoc-11/bai-12-kieu-xau-l4211.html
1:
uses crt;
const fi='songuyen.int';
var f1:text;
i,n:integer;
a:array[1..1000]of integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(f1,a[i]:4);
close(f1);
readln;
end.
Câu 2:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln('Tong a+b la ',a+b);
writeln('Hieu a-b la ',a-b);
writeln('Tich cua a*b la ',a*b);
writeln('Thuong cua a/b la ',a/b:4:2);
readln;
end.
Câu 2: (C++)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << "Tong a+b la: " << a+b << "\nHieu a-b la: " << a-b << "\nTich a*b la: " << a*b << "\nThuong a/b la: " << (double)a/b << endl;
return 0;
}
Chúc bn học tốt!
2