Distinct power numbers: Difference between revisions

Content added Content deleted
(Add C)
(Add C++)
Line 185: Line 185:
printf("\n");
printf("\n");
return 0;
}</lang>
{{out}}
<pre>4 8 9 16 25 27 32 64 81 125 243 256 625 1024 3125</pre>

=={{header|C++}}==
<lang cpp>#include <iostream>
#include <set>
#include <cmath>

int main() {
std::set<int> values;
for (int a=2; a<=5; a++)
for (int b=2; b<=5; b++)
values.insert(std::pow(a, b));
for (int i : values)
std::cout << i << " ";
std::cout << std::endl;
return 0;
return 0;
}</lang>
}</lang>