+ 1

whats the wrong with this code?

#include<stdio.h> #include<conio.h> Int main() { int i,j; clrscr(); for(i=1;i<=11;i+2) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } return 0; } i think the output is * //1 *** //3 ***** //5 ******* : *********. : but its not working help me!

20th Jul 2019, 3:01 PM
atharupu saravana
atharupu saravana - avatar
3 Réponses
20th Jul 2019, 3:05 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 4
#include<stdio.h> #include<conio.h> int main() { int i,j; for(i=1;i<=11;i+=2) { printf("\n"); for(j=1;j<=i;j++) { printf("*"); } } return 0; } The above code works. Try this [EDIT] : I'm sorry I didn't noticed that is an odd iteration. Modified the code so that it can iterate as you like atharupu saravana
20th Jul 2019, 3:23 PM
deeyae
deeyae - avatar
+ 3
atharupu saravana I think you're working with Turbo C Here in Sololearn you need not want to specify clrscr(); And the biggest mistake you made is writing Int main() in the int main() and Return 0; in the place of return 0; I think you know C is a case sensitive language
20th Jul 2019, 3:26 PM
deeyae
deeyae - avatar