Skip to content

Instantly share code, notes, and snippets.

@drage0
Created May 10, 2016 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drage0/1773c2e50b900e56fc1a02560ef7300b to your computer and use it in GitHub Desktop.
Save drage0/1773c2e50b900e56fc1a02560ef7300b to your computer and use it in GitHub Desktop.
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main(void){
unsigned long long int testN;
int x, y;
bool b = false;
printf("Number of tests to run? :");
scanf(" %d", &testN);
for(unsigned long long int i; i < testN; i++){
y = 2;
x = (rand()%3000) + 1;
cout << "[" << i << "]NUMBER " << x << ':' << endl << '\t';
while (x > 1){
while ((x % y) == 0){
x = x / y;
cout << y << '*';
b = true;
}
y++;
}
cout << (b ? "\b " : " ");
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment