Lineare Algebra (42003-42004)

Primzahlenzerlegung

 

Primzahlenzerlegung.cpp
//(C)2001 by Darkleo.com
//
#include <iostream.h>


int PZ[]={2,3,5,7,11,13,17,19,23};

int main()
{
int eingabe;
int i=0;

cout <<
"Geben Sie bitte eine Zahl ein:";
cin >> eingabe;

do
  if(eingabe%PZ[i]==0)
 {
 cout<<PZ[i];
 cout<<
" ";
 eingabe=eingabe/PZ[i]; 
 }
  else
 {
 i++;
 }
}
while(eingabe>1);

return 0;
}