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.

21 tháng 12 2018

Var

i,d,n :integer;

a:array[1..100] of integer;

begin

readln(n);

for i:=1 to n do

readln(a[i]);

for i:=1 to n do

if a[i]>0 then d:=d+1;

write('mang A co :',d,'so nguyen duong');

readln

end.

21 tháng 4 2019

Lời giải :

program hotrotinhoc ;

var a: array[1..32000] of integer ;

i,n,max : integer ;

begin

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

writeln('Nhap gia tri cua cac phan tu');

for i:= 1 to n do

begin

write('a[',i,']='); readln(a[i]);

end;

max:=a[1];

for i:= 1 to n do if max<a[i] then max:=a[i];

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

readln

end.

 

uses crt;

var n,i:integer;

kt:boolean;

begin

clrscr;

repeat

readln(n);

until n<=100;

if (n<2) then writeln('khong la so nguyen to')

else begin

kt:=true;

for i:=2 to trunc(sqrt(n)) do 

  if n mod i=0 then kt:=false;

if kt=true then write('la so nguyen to')

else write('khong la so nguyen to');

end;

readln;

end.

 

 

18 tháng 12 2021

Đề bài yêu cầu gì?

13 tháng 12 2023

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n, dem=0, sum=0; cin >> n;
    ll m=n;
    while(n--) {
        ll x;
        cin >> x;
        if(x==0) break;
        else {
            sum+=x, dem++;
        }
    }
    cout << ((dem==m)?dem:dem+1) << "\n" << sum; //ở đấy mình tính cả số 0 do mình cx k hiểu là đề có bắt tính thêm số 0 hay không (nếu k thì bạn chỉ cần cout << dem là được)
}

Chúc bạn học tốt!

#include <bits/stdc++.h>

using namespace std;

long long t,i,n,x;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x<0) t=t+x;

}

cout<<t;

return 0;

}

10 tháng 5 2022

👊👅😎

10 tháng 5 2022

Jhg

uses crt;

var a:array[1..100]of integer;

n,i,kt,j:integer;

begin

clrscr;

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

for i:=1 to n do

begin

write('A[',i,']='); readln(a[i]);

end;

writeln('Cac so nguyen duong la: ');

for i:=1 to n do

if a[i]>0 then write(a[i]:4);

writeln;

writeln('Cac so nguyen to la: ');

for i:=1 to n do

if a[i]>1 then

begin

kt:=0;

for j:=2 to a[i]-1 do

if a[i] mod j=0 then kt:=1;

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

end;

readln;

end.

uses crt;

var n,i,t,x,max:integer;

st:string;

a:array[1..255]of integer;

begin

clrscr;

repeat

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

until n>0;

str(n,st);

writeln('So chu so cua ',n,' la: ',length(st);

t:=0;

for i:=1 to length(st) do

begin

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

t:=t+a[i];

end;

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

max:=0;

for i:=1 to d do

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

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

readln;

end.

12 tháng 1 2022

bạn viết có dấu đi mình ko hiểu

#include <bits/stdc++.h>

using namespace std;

long long a,b,c,d,e,t;

int main()

{

cin>>a>>b>>c>>d>>e;

t=0;

if ((a%10==0) or (a%10==5)) t=t+a;

if ((b%10==0) or (b%10==5)) t=t+b;

if ((c%10==0) or (c%10==5)) t=t+c;

if ((d%10==0) or (d%10==5)) t=t+d;

if ((e%10==0) or (e%10==5)) t=t+e;

cout<<t;

return 0;

}