Sometimes we initiate with 0...and some time we don't take 0.... what's the reason behind it?
@CodetoCareer4 жыл бұрын
Case 1: Where we MUST give initial value Let us say I need to find Sum of 1 + 2 + 3 + 4...N In this problem, it is MUST to take sum and give it initial value ZERO. Reason being Sum = Sum + 1 then Sum = Sum + 2... so on till N. If we fail to give sum a value of zero, the computer assigns a RANDOM value to SUM. The value for sum could be -400 , 664 etc. Now if you fail to give sum as ZERO then obviously the final answer of the series summation is going to be incorrect. Case 2: num // to read odd or even number Suppose I want to find out if a number is odd or even. My next step would be.. Read num. Here the initial value is of no consequence since I am going to read a value into num. But a general rule of thumb as a good practice is to initialize all variables to zero so that we can quickly find out errors in the code, since we know that the initial value was zero. Hope this makes it clear.
@rakshit99304 жыл бұрын
@@CodetoCareer yes now my doubt is clear...thanku
@MeGamerr4 жыл бұрын
sir in previous lectures u were writing "write " but in ongoing lectures u r writing "print"
@CodetoCareer4 жыл бұрын
kzbin.info/www/bejne/b3q5lot3Zs-fars Watch this around 3:00 mins, Do not skip the sequences...
@sarifurahman56473 жыл бұрын
Plz make a flow chart of it.
@CodetoCareer3 жыл бұрын
You may visit this link kzbin.info/www/bejne/o4vJf2t8oZWCiJI Go to this channel and look at the video tab you shall see all the flowcharts you require.
@rohitchhetri63024 жыл бұрын
Sir can we use elif in place of else if?
@CodetoCareer4 жыл бұрын
In companies of course. During this course better avoided as may create confusion.