Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion Arrays/Arrays.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
## Arrays
## Arrays
## basic array code using c++

#include <bits/stdc++.h>
using namespace std;
int main()
{
int size,arr[100];
cout<<"enter the size of the array"<<endl;
cin>>size;
cout<<"kindly enter the elements"<<endl;
for(int i=0;i<size;i++)
{
cin>>arr[i];
}
for(int i=0;i<size;i++)
{
cout<<"the array element at index" <<i << "is" <<arr[i]<<endl;
}
}

## code for finding max number in an array
#include <bits/stdc++.h>
using namespace std;
int main()
{
int size,arr[100];
int max=0;
cout<<"enter the size of the array"<<endl;
cin>>size;
cout<<"kindly enter the elements"<<endl;
for(int i=0;i<size;i++)
{
cin>>arr[i];
}
cout<<"now find the maximum number"<<endl;
for(int i=0;i<size;i++)
{
if(max<arr[i])
{
max=arr[i];
}
}
cout<<"the maximum array element is "<<max<<endl;
}