hi gentles, i tested a code that
doesn't work. and i want you
helping for the shortest code
quickly. It's maddening me. The
code's duty is showing numbers
( less than 20 ) are prime
together (two numbers have no
parallel multiples ) . And i want
you helping for a right code. The
output should be like this:
2 and 3
2 and 5
2 and 7
...
18 and 19
thanks much ,if you can help to
end it before tommorrow... Can
anybody write it??
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
using namespace std ;
int main()
{
int i,j;
for ( i = 1 ; i <= 19 ; i++ )
{
for ( j = i ; j <= 19 ; j++ )
{
if ( i % j != 0 && j % i != 0 )
cout << i << " and " << j << endl;
}
}
return 0;
}
|