Q.WAP to input 10 elements in an array and then display
these elements.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[10];
int i=0;
for(i=0;i<10;i++)
{
cout<<"Enter element no."<<i+1<<"=";
cin>>arr[i];
cout<<endl;
}
cout<<"Given array is:";
for(i=0;i<10;i++)
{
cout<<arr[i]<<" ";
}
getch();
}
these elements.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[10];
int i=0;
for(i=0;i<10;i++)
{
cout<<"Enter element no."<<i+1<<"=";
cin>>arr[i];
cout<<endl;
}
cout<<"Given array is:";
for(i=0;i<10;i++)
{
cout<<arr[i]<<" ";
}
getch();
}
No comments:
Post a Comment