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.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<a-b;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,x,t;
int main()
{
cin>>n;
t=0;
while (n>0)
{
x=n%10;
t=t+x;
n/=10;
}
cout<<t;
return 0;
}
Var t,n:integer;
begin
write('nhap n = ');readln(n);
while n div 10 <> 0 do
begin
t:=t+(n mod 10);
n:=n div 10;
end;
write('Tong cac chu so cua ',n,' la ',t);
readln;
end.
Câu 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
if n<2 then writeln(n,' khong la so nguyen to')
else begin
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
Bài 1 :
Uses crt;
Var x,y:integer;
Begin
clrscr;
Readln(x,y);
Write('Tong cua x,y la ',x+y);
Readln
End.
Bài 2 :
Uses CRT;
var x,y,z:integer; tbc:real;
begin
clrscr;
readln(x,y,z);
tbc:=(a+b+c)/3;
Write('Trung binh cong x,y,z la ',tbc:4:2);
Readln
End.
1)Program songuyenduong;
Uses crt;
Var y: integer;
Begin
clrscr;
writeln('nhap so y'); readln(y);
if (y mode 5)=0 then writeln(y,'chia het cho 5')else write(y,' khong chia het cho 5');
readln;
End.
Câu 1:
Var a:Integer;
Begin
Writeln('Nhap a: '); Readln(a);
If (a mod 2)=0 then writeln(a,'chia het cho 2') else (a,' khong chia het cho 2');
Readln;
End.
Câu 2:
Var S,a,b,c:Integer;
Begin
Writeln('Nhap a: '); readln(a);
Writeln('Nhap b: '); readln(b);
Writeln('Nhap c: '); readln(c);
S:=a+b+c;
Writeln('Tong cua ba so la: ',S);
Readln;
End.
Câu 3:
Var a,b,c:Integer;
Begin
Writeln('Nhap a: '); Readln(a);
Writeln('Nhap b: '); readln(b);
Writeln('Nhap c: '); readln(c);
If (a mod 2)=0 then writeln(a,' la so chan') else (a,' la so le');
If (b mod 2)=0 then writeln(b,' la so chan') else (b,' la so le');
If (c mod 2)=0 then writeln(c,' la so chan') else (c,' la so le');
Readln;
End.
program bai1;
uses crt;
var i,n,T:longint;
A:array[1..10000] of longint;
begin
write('do dai cua day so,n='); readln(n);
write('nhap cac phan tu cua day so:');
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
T:=0;
for i:=1 to n do T:=T+a[i];
write('tong la:',T);
readln
end.
C2: Program Cau_2;
Var
A,x:integer;
Begin
clrscr;
writeln('Hay nhap so x:');
readln(x);
A:=0;
A:=x*(2+x)-x;
writeln('Bieu thuc A bang:',A:10:5);
Readln;
end.
C3: Program Cau_3;
Var
b:integer;i:integer;A:array[1..10] of integer;
Begin
i:=1;
for b:=1 to 10 do
if 10 and 20 mod b =0 then
readln(A[i]);
i:=i+1;
writeln('Cac uoc chung cua 10 va 20 la:');
for i:=1 to 10 do
write(A[i]);
readln;
end.