Yes this is hw and i have done 47 out of 50 of the problems. I have just gotten stuck on these last 3. if anyone is in the mood to help. please do. I am willing to take pointers as well to help me get along thx.
1. Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j.
i have no idea where to begin
2. Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 whole numbers, and store this value in total. Thus your code should put 1*1 + 2*2 + 3*3 +... + 49*49 + 50*50 into total. Use no variables other than k and total.
i tried this but didnt work?
.Code:while(k<=50){ total=total+k^2; k=k+1;
and 3. Given an int variable k that has already been declared, use a do...while loop to print a single line consisting of 97 asterisks. Use no variables other than k.
i tried
Code:do { printf("*"); } while (k<98);
thanks so much you guys are great.