"Programming is the art and it should be practiced everyday to become an artist"
Before starting programming in any language such as JAVA, C, C#, MATLAB, Python etc, there is a need to eat and digest the below points.
1. Looping
2. Logic of a Program
3. Last but not least syntax of a programming language.
1. Looping:
This is critical and need to learn and digest any one of the looping (while, do-while or for).
The need of looping is essential because usually in the real time applications exact number of times the work need to be carried out during this cases the looping plays a vital role. Some of the examples are below
If there is a need to run loop for 10 times, can choose any of the looping system
For example shall take for loop
In C : for (i=1; i<=10;i++), for(i=0;i<10;i++)
In Matlab :
for i = 1:1:10
end
Like above there can be 'N' ways to implement the loop in different language with different looping types.
While writing the looping take care about the forcing the value to variable as '1' or '0' inside the loop as it leads to wrong answers. Lets consider the example to calculate sum to 10 numbers
if variable which holds the result is forced to 0 inside looping leads to wrong answers
Ex: Sum is the variable used to hold the result
for (i=1;i<=10;i++)
{
sum = 0;
sum = i + sum;
}
the original answer for 1+2+3+4+5+6+7+8+9+10 = 55 (in decimal) but for the above code the answer is 10 because of forcing the variable sum to 0.
Instead the result holding variable should be assigned outside the looping
Ex:
sum = 0;
for(i=1;i<=10;i++) // loops for ten times
{
sum = i + sum; // for every execution the sum is updated based on the integer value i in the loop.
}
for more information visit the link to get more knowledge on looping https://www.youtube.com/watch?v=LhXfw3lM0oo
2. Logic of a program
A Essential part of the programmer where the developer need to understand the problem statement and prepare a paper work to come up with a logic. Only a experts can code onscreen by keeping logic in mind. Beginners do make a paper work and later start coding or else more often end with errors as out brain won't support it.
If the logic is known can code the same in any language (C, C++, Java anything). More often in the interview, companies asks the basics no one ask to solve a complex problem a simple fibonacci series, tribonacci series, binary search etc. While attending the interviews do brush up the logic of small programs.
Last point but not least.
3. Syntax of the programming language
This is the least importance the syntax varies from one programming language to another, before coding with any language learn the compiler rules and syntax.
This is easy within two to three days we can learn the syntax of any language.
For example: refer the first point in this blog which explains the syntax variation for writing the "for loop" in MATLAB and C.
Once the syntax is known can write a program.
Practice is the key if tool is not used for many days again people end up with syntax errors. Example if the person was coding in MATLAB switched to C coder after five months if they start using MATLAB, the usage of C language influences and makes the syntax errors while writing the MATLAB codes.
Please do subscribe to the below the link for the channel is provide,
Subscribe to my channel!
Before starting programming in any language such as JAVA, C, C#, MATLAB, Python etc, there is a need to eat and digest the below points.
1. Looping
2. Logic of a Program
3. Last but not least syntax of a programming language.
1. Looping:
This is critical and need to learn and digest any one of the looping (while, do-while or for).
The need of looping is essential because usually in the real time applications exact number of times the work need to be carried out during this cases the looping plays a vital role. Some of the examples are below
If there is a need to run loop for 10 times, can choose any of the looping system
For example shall take for loop
In C : for (i=1; i<=10;i++), for(i=0;i<10;i++)
In Matlab :
for i = 1:1:10
end
Like above there can be 'N' ways to implement the loop in different language with different looping types.
While writing the looping take care about the forcing the value to variable as '1' or '0' inside the loop as it leads to wrong answers. Lets consider the example to calculate sum to 10 numbers
if variable which holds the result is forced to 0 inside looping leads to wrong answers
Ex: Sum is the variable used to hold the result
for (i=1;i<=10;i++)
{
sum = 0;
sum = i + sum;
}
the original answer for 1+2+3+4+5+6+7+8+9+10 = 55 (in decimal) but for the above code the answer is 10 because of forcing the variable sum to 0.
Instead the result holding variable should be assigned outside the looping
Ex:
sum = 0;
for(i=1;i<=10;i++) // loops for ten times
{
sum = i + sum; // for every execution the sum is updated based on the integer value i in the loop.
}
for more information visit the link to get more knowledge on looping https://www.youtube.com/watch?v=LhXfw3lM0oo
2. Logic of a program
A Essential part of the programmer where the developer need to understand the problem statement and prepare a paper work to come up with a logic. Only a experts can code onscreen by keeping logic in mind. Beginners do make a paper work and later start coding or else more often end with errors as out brain won't support it.
If the logic is known can code the same in any language (C, C++, Java anything). More often in the interview, companies asks the basics no one ask to solve a complex problem a simple fibonacci series, tribonacci series, binary search etc. While attending the interviews do brush up the logic of small programs.
Last point but not least.
3. Syntax of the programming language
This is the least importance the syntax varies from one programming language to another, before coding with any language learn the compiler rules and syntax.
This is easy within two to three days we can learn the syntax of any language.
For example: refer the first point in this blog which explains the syntax variation for writing the "for loop" in MATLAB and C.
Once the syntax is known can write a program.
Practice is the key if tool is not used for many days again people end up with syntax errors. Example if the person was coding in MATLAB switched to C coder after five months if they start using MATLAB, the usage of C language influences and makes the syntax errors while writing the MATLAB codes.
Please do subscribe to the below the link for the channel is provide,
No comments:
Post a Comment