code:
#include<bits/stdc++.h> int main() { int i,n,ct=0;; scanf("%d",&n); for(i=2;i<=sqrt(n);i++) { if(n%i==0) { ct=0; while(n%i==0) { n=n/i; ct++; } printf("(%d^%d)X",i,ct); } } if(n!=1) printf("%d^%d",n,1); //it's cleared but will see more about this in future return 0; }
I/O:
input: 36 output: (2^2)X(3^2)X