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.

#include <bits/stdc++.h>

using namespace std;

long long n;

int main()

{

cin>>n;

int ln=0;

while (n>0) 

{

int x=n%10;

ln=max(ln,x);

n=n/10;

}

cout<<x;

}

#include <bits/stdc++.h>
using namespace std;
long long n;
//chuongtrinhcon
int tongchuso(long long n)
{
    int t=0;
    while (n>0)
    {
        int x=n%10;
        t=t+x;
        n=n/10;
    }
    return(t);
}
//chuongtrinhchinh
int main()
{
   freopen("sonut.inp","r",stdin);
   freopen("sonut.out","w",stdout);
   cin>>n;
   int t=tongchuso(n);
   while (t>10)
   {
       t=tongchuso(t);
   }
   cout<<t;
   return 0;
}

 

 

#include <bits/stdc++.h>

using namespace std;

int main()

{

long a[105], i,n,max,vt;

cout<<"n="; cin>>n;

for (i=1; i<=n; i++)

{

cout<<"A["<<i<<"]="; cin>>a[i];

}

max=a[1];

for (i=1; i<=n; i++)

if (max<a[i]) max=a[i];

vt=1;

for (i=1; i<=n; i++)

if (max==a[i]) vt=i;

cout<<max<<endl;

cout<<vt;

return 0;

}

 

10 tháng 10 2022

bài này sai r bạn ơi

 

7 tháng 1 2022

Số N (0<N<10 mũ 9)

7 tháng 1 2022

N = int(input())
A = 0
B = 0
So_uoc = 0
KQ = ""
for x in range(1, N):
    if (x%2==0) and (x%3==0):
        A += 1
    if (x>0) and (N%x==0):
        if (x>B):
            B = x
for i in range(1, N+1):
    if (N%i==0):
        So_uoc += 1
if (So_uoc == 2):
    KQ = "YES"
else:
    KQ = "NO"
print(A)
print(B)
print(len(str(N)))
print(KQ)

(Chẳng biết đúng không đâu bucminh)

12 tháng 12 2019

uses crt;
const fi='dt.inp';
fo='dt.out';
var n,i,d,x,t,ln,kt:integer;
st:string;
a:array[1..100]of integer;
f1,f2:text;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
{-------------------------cau-a-----------------------}
str(n,st);
d:=length(st);
for i:=1 to d do
val(st[i],a[i],x);
t:=0;
for i:=1 to d do
begin
if a[i]=0 then t:=t+6;
if a[i]=1 then t:=t+2;
if a[i]=2 then t:=t+5;
if a[i]=3 then t:=t+5;
if a[i]=4 then t:=t+4;
if a[i]=5 then t:=t+5;
if a[i]=6 then t:=t+6;
if a[i]=7 then t:=t+3;
if a[i]=8 then t:=t+7;
if a[i]=9 then t:=t+6;
end;
writeln(f2,t);
{-----------------------cau-b---------------------------}
ln:=a[1];
for i:=1 to d do
if ln<a[i] then ln:=a[i];
writeln(f2,ln);
{--------------------cau-c-------------------------------}
kt:=0;
for i:=1 to d-1 do
if a[i]>a[i+1] then kt:=1;
if kt=0 then writeln(f2,'T')
else begin
kt:=0;
for i:=1 to d-1 do
if a[i]<a[i+1] then kt:=1;
if kt=0 then writeln(f2,'L')
else writeln(f2,'0');
end;
close(f1);
close(f2);
readln;
end.

uses crt;

var p:real;

begin

clrscr;

write('Nhap chu vi:'); readln(p);

writeln(sqr(p/4):4:2);

readln;

end.

25 tháng 4 2021

giải theo cách nhập xuất file fi,fo giúp em với ạ

30 tháng 10 2021

uses crt;

var a:array[1..50]of int64;

i,n,t,max,min:int64;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

max:=a[1];

min:=a[1];

t:=0;

for i:=1 to n do 

begin

if max<a[i] then max:=a[i];

if min>a[i] then min:=a[i];

t:=t+a[i];

end;

writeln('Tong la: ',t);

writeln('So lon nhat la: ',max);

write('Vi tri la: ');

for i:=1 to n do

if a[i]=max then write(i:4);

writeln;

writeln('So nho nhat la: ',min);

write('Vi tri la: ');

for i:=1 to n do 

if a[i]=min then write(i:4);

readln;

end.