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.
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;
}
#include <bits/stdc++.h>
using namespace std;
string n;
int d;
int main()
{
cin>>n;
d=n.length();
cout<<d;
return 0;
}
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.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
cout<<n*n;
return 0;
}
uses crt;
var a,b:longint;
Begin
clrscr;
Writeln('Nhap a,b=');
Readln(a,b);
writeln('tich hai so la : a*b=',a*b);
writeln('thuong hai so la :a/b=',a/b);
Readln;
End.
uses crt;
var a:array[1..100]of integer;
i,n,x,dem,kt:integer;
begin
clrscr;
write('nhap n='); readln(n);
if n=1 then a[1]:=2
else begin
a[1]:=2;
x:=1;
dem:=1;
repeat
x:=x+2;
kt:=0;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then kt:=1;
if kt=0 then begin
inc(dem);
a[dem]:=x;
end;
until dem=n;
end;
{-----------------------------------------}
writeln(n,' so nguyen to dau tien la:');
for i:=1 to n do
write(a[i]:4);
{--------------------------}
readln;
end.
uses crt;
var n,t:int64;
dem,i:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
until (0<n) and (n<1000000000);
writeln('Cac so chinh phuong trong khoang tu 1 toi ',n,' la: ');
dem:=0;
t:=0;
for i:=1 to n do
if sqrt(i)=trunc(sqrt(i)) then
begin
write(i:6);
inc(dem);
t:=t+i;
end;
writeln;
writeln('So so chinh phuong trong khoang tu 1 toi ',n,' la: ',dem);
writeln('Tong cac so chinh phuong trong khoang tu 1 toi ',n,' la: ',t);
readln;
end.