big question in numbers are prime together...

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??
Last edited on
Well, where is your current code then?
i have a wrong and long code that isn't useful i want know everybody can give me a right code to test it.
I think it would be more instructive to help you fix what you did wrong, rather than giving you a working solution.
We are here not to do your homework. You should try to redo it yourself and if it still won't work, just post again with the code and ask help for specific problem about it :)
your used word was nasty for a young. I am an old chemist that wants to know about any unsolved question in the science. It's not my homework. It was 30 years ago. And i want to compare lenght of your codes for seleceting the shortest.
Young, If you can't please do like a gentleman.not a schoolboy. Have Anybody a code?
my wrong and long code young programmers:

#include <iostream>

using namespace std ;

int main()
{
float i,j;

for ( i = 1 ; i <= 20 ; i++ )

{

for ( j = 1 ; j <= i ; j++ )

{

if ( i % j != 0 && j % i != 0 )
cout << i << " and " << j << endl;
}

}
return 0;

}
Topic archived. No new replies allowed.