while loop simple question

write a while loop to print the integers from 1 to 20. print only 5 intergers per line.
can someone help me this question??thanks
int x = 0;
while(x<20)
{
x++;
cout << x;
if(x%5==0)
cout << endl;
}
Topic archived. No new replies allowed.