Write a code segment to print your name ten times on the screen using a while loop. Use one variable called count to act as a counter for the loop. Discuss how would you print your name 1000 times on the screen.
NOTE:
You can either type your code into the text box or upload a document to the discussion board by clicking the "attach" clip at the bottom left of the discussion box.
I consider a language which is the most basic....c language....
Here is your code:
#include<stdio.h>
int main()
{
int i=0;
int count=0; //counter variable
while(i<10) //to print your name 1000 times,you can repace 10 with 1000 and ur code will work
{
printf("My name is Ghostrider\n");
i++;
count++;
}
printf("The value of count is %d",count); //count will specify you for how much time your while loop ran....my counting the value each time the while loop works
return 0;
}
.....................................
I used it on dev c++......and it worked properly.......hope this may help you....Have a nice day ahead.....
Get Answers For Free
Most questions answered within 1 hours.