Skip to content

basic array code #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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;
}