Program to Display numbers using Arrray in C++.

In this program, user can Display his entered numbers and can know first

and last number.

 

Let’s write a program which Print Array in C++.

 

 

Step 1: Let’s open turboC++ and write the following code.

 

//Code

 

//Add preprocessor

 

#include<iostream.h>

#include<conio.h>

void main()

{

int i,a[10];

clrscr();

cout<<”enter all numbers:”;

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

{

cin>> a[i];

}

cout<<”numbers are:”;

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

{

cout<<”\n ”<<a[i];

}

cout<<”\n first number is :”<<a[0];

cout<<”\n last number is :”<<a[9];

getch();

}

 

 

 

Step 2: Run the program and see output.

 

 

Output:

 

 

output

 

Happy coding.

 

 

Tags: , ,