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 50 times, 1 visits today)
Written by: