K
Khách

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 a:string;
n,i,kt,kt1,t,x,kt2,j,d:integer;
b:array[1..255]of integer;
begin
clrscr;
write('Nhap so chu so:'); readln(n);
repeat
write('Nhap so a='); readln(a);
kt:=0;
for i:=1 to length(a) do
if not(a[i] in ['0'..'9']) then kt:=1;
if kt=0 then
begin
kt1:=0;
if length(a)<>n then kt1:=1;
end;
until (kt=0) and (kt1=0);
writeln('So chu so cua so ',a,' la: ',n);
d:=length(a);
t:=0;
for i:=1 to d do
begin
val(a[i],b[i],x);
t:=t+b[i];
end;
writeln('Tong cac chu so sau khi chia cho 3 la: ',t/3:4:2);
writeln('Cac chu so cua so ',a,' la so nguyen to la: ');
for i:=1 to d do
if b[i]>1 then
begin
kt2:=0;
for j:=2 to b[i]-1 do
if b[i] mod j=0 then kt2:=1;
if kt2=0 then write(b[i]:4);
end;
readln;
end.

20 tháng 12 2020

1:

uses crt;

var a,b:integer;

begin

clrscr;

write('Nhap a='); readln(a);

write('Nhap b='); readln(b);

if (a>0) and (b>0) then writeln('Cung dau');

if (a<0) and (b<0) then writeln('Cung dau');

if (a>0) and (b<0) then writeln('Khac dau');

if (a<0) and (b>0) then writeln('Khac dau');

readln;

end.

2: 

uses crt;

var n,i,d,t,x,y:integer;

st:string;

begin

clrscr;;

repeat

write('Nhap n='); readln(n);

until (100<=n) and (n<=999);

str(n,st);

d:=length(st);

t:=0;

for i:=1 to d do 

  begin

val(st[i],x,y);

if x mod 2=1 then t:=t+x;

end;

writeln('Tong cac chu so le cua ',n,' la: ',t);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

string n;

int d;

int main()

{

cin>>n;

d=n.length();

cout<<d;

return 0;

}

4 tháng 1 2022

pascal mà bạn!

 

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[10],i;

bool kt;

int main()

{

for (i=1; i<=10; i++) cin>>a[i];

kt=true;

for (i=1; i<=9; i++) if (a[i]>a[i+1]) kt=false;

if (kt==true) cout<<"YES";

else cout<<"NO";

return 0;

}

17 tháng 12 2021

#include <bits/stdc++.h>
using namespace std;
string st;
int d,i,kt;
char x,ln;
int main()
{
    getline(cin,st);
    d=5;
    x=st[2];
    ln=st[0];
    for (i=1; i<=d-1; i++)
      if (ln<=st[i]) ln=st[i];
    if (ln==x) cout<<"YES";
    else cout<<"NO";
    return 0;
}

 

1 tháng 10 2016

PHP Code:
#include <iostream>
using namespace std;
int SoNT(int a)
{
int dem=0;
for(int i=1;i<=a;i++)
if(a%i==0)
dem++;
if(dem==2)
return 1;
return 0;
}
void main()
{
int a,dem=0;
cout<<"Nhap vao so a co 5 chu so tu 1--99999: ";
cin>>a;
while(a!=0)
{
int t=a%10;
if(t!=1)
dem+=SoNT(t);
a=a/10;
}
cout<<"Co "<<dem<<" so nguyen to"<<endl;
}

21 tháng 4 2017

B