Posted By

Desoxena on 12/08/10


Tagged

numbers program factor c++ Desoxena


Versions (?)

number factorer program


 / Published in: C++
 

input a number, and the program will factor it. (has not been tested, may be buggy.)

  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <stdio.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int i, j;
  10.  
  11. cout << "*-------------------------*" << endl;
  12. cout << "| number factorer program |" << endl; //center the title box (to look better)
  13. cout << "*-------------------------*" << endl;
  14. cin >> i;
  15. if (i >= 1)
  16. {
  17. cout << i << " is divisible by:" << endl;
  18. for(j=1;j!=i;j++);
  19. if (j%i=0)
  20. {
  21. cout << j << endl;
  22. }
  23.  
  24. }
  25. system("pause");
  26. }

Report this snippet  

You need to login to post a comment.