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.
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('n='); readln(n);
if (n>=0) and (n<=100) then
begin
s:=0;
for i:=1 to n do
s:=s+(i/(i+1));
writeln('tong la: ',s);
end
else writeln('vui long nhap lai');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
string n;
int d;
int main()
{
cin>>n;
d=n.length();
cout<<d;
return 0;
}
Program hotrotinhoc;
var s: longint;
i,n: integer;
function lt(x,y: integer): longint;
var l,t: longint;
begin
t:=1;
for l:=1 to y do t:=t*x;
lt:=t;
end;
begin
write('N='); readln(n);
for i:=2 to n do
if (i-1) mod 2<>0 then s:=s+lt((i-1),i)
else
if (i-1) mod 2=0 then s:=s-lt((i-1),i);
write(s);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,t1,t2,t3:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t1:=0;
t2:=0;
t3:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then t1:=t1+a[i]
else t2:=t2+a[i];
if (a[i] mod 2=0) and (a[i] mod 3=0) then t3:=t3+a[i];
end;
writeln(t1);
writeln(t2);
writeln(t3);
readln;
end.
Var n,sc,sl,i:longint;
Begin
Write('N = ');readln(n);
Write('Cac so tu 1 den ',n,' la ');
For i:=1 to n do
Write(i:8);
Writeln;
For i:=1 to n do
Begin
If i mod 2 = 0 then sc:=sc+i
Else sl:=sl+i;
End;
Writeln('Tong cac so chan la ',sc);
Write('Tong cac so le la ',sl);
Readln
End.
1:
#include <bits/stdc++.h>
using namespace std;
long long a[100],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cout<<"Day ban dau la: "<<endl;
for (i=1;i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
sort(a+1,a+n+1);
cout<<"Day tang dan la: "<<endl;
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
1.
var n: integer;
begin
repeat
write('Nhap so n: '); readln(n);
until (n>=10) and (99>=n);
writeln('Chu so hang chuc la: ', n div 10);
writeln('Chu so hang don vi la: ', n mod 10);
end.
2.
var n,i: integer;
s: string;
begin
repeat
write('Nhap so n: '); readln(n);
until (n>=100) and (999>=n);
write('So moi la: ');
str(n,s);
for i:=length(s) downto 1 do write(s[i]);
end.