0% found this document useful (0 votes)
5 views3 pages

Niz

The document contains three C++ programs that demonstrate different functionalities with arrays. The first program collects six elements from the user and displays them, the second program allows the user to specify the size of the array and prints the elements in reverse order, and the third program collects ten elements and prints only the odd numbers. Each program uses standard input and output for interaction.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Niz

The document contains three C++ programs that demonstrate different functionalities with arrays. The first program collects six elements from the user and displays them, the second program allows the user to specify the size of the array and prints the elements in reverse order, and the third program collects ten elements and prints only the odd numbers. Each program uses standard input and output for interaction.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <iostream>

using namespace std;

int main(int argc, char** argv) {

int i;

int A[6];

cout<<"Unesite elemente niza:"<<endl;

for(i=0;i<6;i++){

cout<<"A["<<i<<"] :";

cin>>A[i];

cout<<"Ispis niza:"<<endl;

for(i=0;i<6;i++){

cout<<"A["<<i<<"]="<<A[i];

cout<<endl;

return 0;

}
#include <iostream>

using namespace std;

int main(int argc, char** argv) {

int i,n;

cout<<"Unesite clanove niza:"<<endl;

cin>>n;

int A[n];

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

cout<<"A["<<i<<"] :";

cin>>A[i];

cout<<"Ispis niza:"<<endl;

for(i=n-1;i>=0;i--){

cout<<"A["<<i<<"]="<<A[i]<<" ";

cout<<endl;

return 0;

}
#include <iostream>

using namespace std;

int main(int argc, char** argv) {

int i;

int A[10];

for(i=0;i<10;i++){

cout<<"A["<<i<<"] :";

cin>>A[i];

cout<<"Ispis niza:"<<endl;

for(i=0;i<10;i++){

if(A[i]%2==1){

cout<<"A["<<i<<"]="<<A[i]<<" ";

cout<<endl;

return 0;

You might also like