We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
because we have to print sum in output.
So , in for loop we traverse all element and add it in variable names sum and display it
eg - we have array={1,2,3,4,5}
when we run loop from i=0 it add a[0] (i.e - 1) in sum variable , similarly we run it till i=4 (i.e -5) .
so sum=1+2+3+4+5
1D Arrays in C
You are viewing a single comment's thread. Return to all comments →
because we have to print sum in output. So , in for loop we traverse all element and add it in variable names sum and display it eg - we have array={1,2,3,4,5} when we run loop from i=0 it add a[0] (i.e - 1) in sum variable , similarly we run it till i=4 (i.e -5) . so sum=1+2+3+4+5
i'm not good in explaining but hope it helps :)
thanku so much i got it :) thanku is less to u. u solve my problem in a second. i search this so much on chatgpt also but dont got this :)