Thursday, July 9, 2009

Can anybody know the right syntax of this output? (It should be a c program using while loop statement)?

*****


****


***


**


*

Can anybody know the right syntax of this output? (It should be a c program using while loop statement)?
dot put home works to it.....ok





#include%26lt;conio.h%26gt;


#include%26lt;stdio.h%26gt;


void main()


{


clrscr();


int i=5,j;


while(i%26gt;0) //this loop is used for controlling lines


{


j=0;


while(j%26lt;i) //this loop is used for number of *


{


printf("*");


j++;


}


printf("\n");


i--;


}


getch();


}
Reply:i didnt check the syntax but it could be something like this





int i=5;





while (i%26gt;0)


{


for (int j=i;j%26gt;0;j--)


{


printf("*");


}


printf("\n");


i--;


}
Reply:As a former Uni Lecturer, NOBODY should answer this question.





It is a standard assignment for the first week of a programming course. And it's in all the text books. Which tells me that bsmath has not purchased the recommended text or Google'd.





The first reply given here that works will be copied and pasted and submitted as the bsmath's own work. In short, plagiarism. The pity of it is that nothing is learned - short of how to cheat..





%26lt;/rant%26gt;


No comments:

Post a Comment