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.
1 không
2
Program UCLN;
uses crt;
var a,b : integer;
begin
write ('nhap so a la ');readln (a);
write ('nhap so b la ');readln (b);
while a < > b do
if a >b then a := a - b else b := b - a ;
write ( ' UCLN la :' , a );
readln
end.
1:
#include <bits/stdc++.h>
using namespace std;
int n,i;
bool kt;
int main()
{
cin>>n;
kt=true;
for (i=2; i*i<=n; i++)
if (n%i==0) kt=false;
if (kt==true && n>1) cout<<"La so nguyen to";
else cout<<"Khong la so nguyen to";
return 0;
}
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n>0 && n%5==0) cout<<"Phai";
else cout<<"Khong phai";
}
Cau 1:
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n>0 && n%5==0) cout<<"Phai";
else cout<<"Khong phai";
}
Bài 2:
#include <bits/stdc++.h>
using namespace std;
long long x,y;
int main()
{
cin >>x>>y;
cout<<x<<" "<<y;
swap(x,y);
cout<<x<<" "<<y;
return 0;
}
uses crt;
var n,i:integer;
m:real;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (1<=n) and (n<=30000);
m:=0;
for i:=1 to n do
m:=m+sqrt(i);
writeln('m=',m:4:2);
readln;
end.
Bài 1:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 6=0 then s:=s+i;
writeln(s);
readln;
end.
Bài 2:
uses crt;
var a,b,c,ucln,i:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
while a<>b do
begin
if a>b then a:=a-b
else b:=b-a;
end;
ucln:=a;
while ucln<>c do
begin
if ucln>c then ucln:=ucln-c
else c:=c-ucln;
end;
writeln(ucln);
readln;
end.
uses crt;
var a:integer;
begin
clrscr;
write('Nhap a='); readln(a);
if a<0 then writeln(a,' la so am')
else if a>0 then writeln(a,' la so duong')
else writeln(a,' khong la so am cung khong la so duong');
readln;
end.
var A: integer;
begin
write('Nhap vao mot so A='); readln(A);
if A>0 then write('So A la so nguyen duong');
if A<0 then write('So A la so nguyen am');
If A=0 then write('So A khong la so nguyen am va khong la so nguyen duong');
readln;
end.
program Tim_Uoc;
uses crt;
var
n, i: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
writeln('Cac uoc cua so ', n, ' la: ');
for i:=1 to n do
begin
if n mod i = 0 then
writeln(i);
end;
readln;
end.
1) var a,b,c,d,h,g:integer;
begin
write('a=');readln(a);
write('b=');readln(b);
write('c=');readln(c);
write('d=');readln(d);
h:=a;
if b>h then h:=b;
if c>h then h:=c;
if d>h then h:=d;
g:=a;
if b<g then g:=b;
if c<g then g:=c;
if d<g then g:=d;
writeln(' So lon nhat trong 4 so la: ',h);
writeln(' So be nhat trong 4 so la: ',g);
readln;
end.
2) var a:integer;
begin
write('a=');readln(a);
if a mod 2=0 then writeln(a,' la so chan ')
else writeln(a,' la so le ');
readln;
end.