In this program, we assigned n=5 for running the loop?

Find the largest number in array
Here we initialised the n=5 for the purpose of running the loop or for the purpose of taking inputs from array ?

hi @rishabhsinghrajput1971_017ffc8383d309dc,
here in this case its for looping but that’s also same as no of element
but since here array is defined with its element so only for looping

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Can I initialise an array like this
Int arr[n]={10, 20,30,40};
Int n=5;

no n should be initialized before and should be consistent with the no of elements

Ok. It means
Instead of this
Int a [5]={1,2 3, 4,5};

I can also write

Int n=5;

Int a [n]={1,2 3, 4,5};

Both are correct syntax
Right??

@rishabhsinghrajput1971_017ffc8383d309dc yes exactly …in comma separated way ( u missed after 2 )

O ya, my bad. But thanks for fast replying

@rishabhsinghrajput1971_017ffc8383d309dc no issues :slight_smile: