Write a Program to an Array by Using Enter values from User.

#include<iostream.h>
#include<conio.h>
#define max 10
void main(){
	clrscr();
	int i,n=0;
	int arry[max];
	cout<<"Enter the Elements to Add Max(10) ";
	cin>>n;
	if(n>max) cout<<"Sorry Max Length of Array is "<<max;
	else{
		for(i=0;i<n;i++){
			cout<<"Element ARRAY["<<i<<"] ";
			cin>>arry[i];
		}
		cout<<"Elements in Array ";
		for(i=0;i<n;i++){
			cout<<"\n ARRAY["<<i<<"] = "<<arry[i];
		}
	}
	getch();
}

Program Output:

(Visited 45 times, 1 visits today)
Share with Friends :
Written by:

Leave a Reply

Your email address will not be published. Required fields are marked *