Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
#include<stdio.h>
void main() {
int i,j;
for(i=1; i<=5; i++){
for(int j=i;j<=5;j++)
{
printf("%d ",j);
}
printf("\n");
}
}
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]
-----
Learn to analyze problems, start simple
This code will print the first column:
#include<stdio.h>
void main() {
int i;
for(i=1; i<=4; i++){
printf("%d ",i);
printf("\n");
}
}
then add the second column
#include<stdio.h>
void main() {
int i;
for(i=1; i<=4; i++){
printf("%d ",i); printf("%d",i+1); printf("\n");
}
}
- Learn one or more analyze methods, E.W. Djikstra/N. Wirth
Stepwize Refinment/top-Down method is a good start.
Structured Programming.pdf[
^]
https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design[
^]
https://en.wikipedia.org/wiki/Structured_programming[
^]
https://en.wikipedia.org/wiki/Edsger_W._Dijkstra[
^]
https://www.cs.utexas.edu/users/EWD/ewd03xx/EWD316.PDF[
^]