Advertisement
Guest User

g5b4reingoj4e

a guest
Nov 12th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct nr
  6. {
  7. int f,p;
  8. }v[100];
  9.  
  10. int main()
  11. {
  12. nr v[100];
  13. int x,n=0,f=2,k,i;
  14. cin>>x;
  15. while(x>1)
  16. {
  17. k=0;
  18. while(x%f==0)
  19. {
  20. k++;
  21. x/=f;
  22. }
  23. if(k!=0)
  24. {
  25. v[n].f=f;
  26. v[n].p=k;
  27. n++;
  28. }
  29. f++;
  30. }
  31. for(i=0;i<n;i++)
  32. cout<<"factorul " <<v[i].f <<" la puterea " <<v[i].p<<endl;
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement