Code:#include<stdio.h> main() { int i,j; for(i=1;i<=4;i++) { for(j=1;j<=4-i;j++) { printf(" "); } for(j=1;j<=2*i-1;j++) { printf("*"); } printf("\n"); }
Code:#include<stdio.h> main() { int i,j; for(i=1;i<=4;i++) { for(j=1;j<=4-i;j++) { printf(" "); } for(j=1;j<=2*i-1;j++) { printf("*"); } printf("\n"); }
Have you tried running it?
Perhaps go though and rename the lousy variable names with something better, say
for ( rowNumber = 1;rowNumber <=4;rowNumber ++)
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.