How do you write a for loop to print the following line:
*****
see first of all see what u have to do .... ur requirement is to print 5 stars in single line ....and u must also be knowing that the for loop consists of 3 parts nmely:
1) initialization 2) condition and 3) increment and decrement
now u see that u have to print first single star then 2nd then 3rd and then so on
so loop will be like initialization : 1(i=1) n condiotn will be like untill n unless its equal to 5 (i<=5)and increment with 1 (i++)
and then print the star..
see first of all see what u have to do .... ur requirement is to print 5 stars in single line ....and u must also be knowing that the for loop consists of 3 parts nmely:
1) initialization 2) condition and 3) increment and decrement
now u see that u have to print first single star then 2nd then 3rd and then so on
so loop will be like initialization : 1(i=1) n condiotn will be like untill n unless its equal to 5 (i<=5)and increment with 1 (i++)
and then print the star..
AAMOF you can use any loop as long as its body is executed 5 times in this case.
The following loop will also be valid:
Comment