Size of array is taken from user as n. then n numbers are stored in array..Array is displayed as output.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int ar[10],n;
- cout<<"Enter size of the array: ";
- cin>>n;
- cout<<"Enter array element: "<<endl;
- for(int i=0;i<n;i++)
- //Coding by: Snehil Khanor
- //http://WapCPP.blogspot.com
- {
- cout<<"Enter element "<<i<<": ";
- cin>>ar[i];
- }
- cout<<"Elements of array: "<<endl;
- for(i=0;i<n;i++)
- cout<<"Element at index number "<<i<<" is: "<<ar[i]<<endl;
- getch();
- }
0 comments:
Post a Comment