English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

5 answers

There are many ways to do this. Here are two ways:

1)

for (int i = 10; i < 2000; i++)
{
if ( i %10 == 0)
{
cout << i;
}
}


2)

for(int i = 10; i < 2000; i = i + 10)
{
cout << i;
}

2007-02-25 13:25:29 · answer #1 · answered by Silver_Sword 3 · 1 0

for(i=10;i<2000;i++)
{
if(i%10 == 0)
cout< }
OR

for (i=10;i<2000;i+=10)
{
cout< }
this will require fewer iterations than the above code.

2007-02-25 21:49:31 · answer #2 · answered by Anonymous · 0 0

here It's works
#include
using namespace std;

int main(){


cout << "NUMBER LESS THAN 2000 DIVISIBLE BY 10";
cout << endl;

for(unsigned int a = 0; a <= 2000; a++){
if((a % 10)== 0){
cout << a;
cout << endl;
}
}
system("PAUSE");
return 0;
}

2007-02-25 21:39:01 · answer #3 · answered by Best Helper 4 · 0 0

#include
#include

void main()
{

clrscr();
int ctr=1;
cout<<"Numbers less than 2000 and divisble by 10"<
while (ctr!=2001)
{
if (ctr%10==0)
{
cout< }
ctr++;
}
}

For further information, contact coolcanc@yahoo.com

2007-02-25 20:50:14 · answer #4 · answered by Santosh 2 · 0 1

rough draft if somethig like this

unsigned short n;

for(n=1;n<2000;n++)
{
if(n%10) printf("%i",n)
}

2007-02-25 20:47:18 · answer #5 · answered by Anonymous · 0 1

fedest.com, questions and answers