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.

29 tháng 10 2018

mọi người ai giúp mình với chuẩn bị kt rồi

29 tháng 12 2020

phần a

29 tháng 12 2020

phần b

7 tháng 10 2021

eoeo

Bài 1.

Bước 1. Nhập N và dãy số a1,a2,...,aNa1,a2,...,aN

Bước 2. i←1i←1S←0S←0

Bước 3. i←i+1i←i+1

Bước 4. 4.1 Nếu i>Ni>N thì kết thúc thuật toán và đưa ra kết quả.

4.2 ai≥0ai≥0 thì quay lại bước 3

4.3 S←S+aiS←S+ai rồi quay lại bước 3

Câu 4: 

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a[100],n,i,t;

cin>>n;

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

cin>>a[i];

t=0;

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

if (a[i]<0) t=t+a[i];

cout<<t;

return 0;

}

Câu 4: 

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a[100],n,i,t;

cin>>n;

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

cin>>a[i];

t=0;

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

if (a[i]<0) t=t+a[i];

cout<<t;

return 0;

}

Câu 4: 

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a[100],n,i,t;

cin>>n;

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

cin>>a[i];

t=0;

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

if (a[i]<0) t=t+a[i];

cout<<t;

return 0;

}

Câu 4: 

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a[100],n,i,t;

cin>>n;

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

cin>>a[i];

t=0;

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

if (a[i]<0) t=t+a[i];

cout<<t;

return 0;

}

Câu 4: 

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a[100],n,i,t;

cin>>n;

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

cin>>a[i];

t=0;

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

if (a[i]<0) t=t+a[i];

cout<<t;

return 0;

}

9 tháng 1 2021

#include <iostream>

#include <fstream>

using namespace std;

ifstream input("D:/input.txt");

ofstream output("D:/ouput.txt");

int main()

{   

    int A[1000];

    int n ,dem=0;

    input >> n;

    for(int i=0;i<n;i++)       

        input >> A[i];   

    for(int i=0;i<n;i++)       

           if(A[i]<0)           

              dem +=A[i]; 

    output << dem; 

     return 0;

}

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

t:=0;

for i:=1 to n do 

  if a[i]<0 then t:=t+a[i];

writeln('Tong cac so nguyen am la: ',t);

readln;

end.

a: #include <bits/stdc++.h>

using namespace std;

long long n,i,x,dem;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

if (x%2!=0) dem++;

}

cout<<dem;

return 0;

}

uses crt;

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

i,n,dem,t,t1,t2,t3,t4:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=250);

for i:=1 to n do 

  begin

repeat

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

until (0<a[i]) and (a[i]<=500);

end;

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=1 then inc(dem);

writeln('So phan tu co gia tri le la: ',dem);

t:=0;

for i:=1 to n do 

  if i mod 2=0 then t:=t+a[i];

writeln('Tong cac phan tu co chi so chan la: ',t);

t1:=0;

for i:=1 to n do 

  if i mod 2=1 then t1:=t1+a[i];

writeln('Tong cac phan tu co chi so le la: ',t1);

t2:=0;

for i:=1 to n do 

  if (i mod 2=0) and (a[i] mod 2=0) then t2:=t2+a[i];

writeln('Tong cac phan tu chan co chi so chan la: ',t2);

t3:=0;

for i:=1 to n do 

  if (i mod 2=1) and (a[i] mod 2=1) then t3:=t3+a[i];

writeln('Tong cac phan tu co chi so le la: ',t3);

t4:=0;

for i:=1 to n do 

  t4:=t4+a[i];

writeln('Trung binh cong cac so trong day la: ',t4/n:4:2);

readln;

end.