Tee Shirts Selection By Sports Teacher – CSKC
Sign In

Search

Solved Problem #CPP#5011    siteicon   siteicon  

Problem Statement - Tee Shirts Selection By Sports Teacher

A sports teacher has been confidentially asked to reject the persons whose Tee-shirt numbers are divisible by 10. Make a program to help this teacher collect the T-shirt numbers one by one and stop counting when 10 persons have been counted. Keep printing the selected Tee-shirt numbers.

Solution

TC++ #5011

 

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

int n; //This will contain the number on the tee-shirt
int count=1; //This counts the number of tee-shirts to be picked
while(count<=10) //Loop till 10 tee-shirts are picked
{
cout<<“Enter T-Shirt Number :”; cin>>n; //Getting possible tee-shirt number from the user
if(n%10==0) continue; //Use of continue to loop further if the number is divisible by 10
else
{
cout<<n<<” “<<endl; //Otherwise keep printing the selected number
count++;                       //Count increases only when tee-shirt is selected
}
}


Share

Created: 23-Nov-2018 00:02 | Updated: 29-Nov-2018 17:19|