///...................SUBHASHIS MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///.....................SESSION-(14-15)....................///
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<ctype.h>
#include<bits/stdc++.h>
using namespace std;
main()
{
long int a;
while(scanf("%ld",&a)!=EOF)
{
if(a==0)
break;
else if(a<0)
{
printf("%ld = -1 x",a);
a=a*-1;
}
else if(a>0)
{
printf("%ld =",a);
}
long k=0,i,j,ar[10000]={0};
for(i=2;i<=sqrt(a);i++)
{
while(a%i==0)
{
ar[k]=i;
k++;
a=a/i;
}
}
ar[k]=a;
if(ar[k]==1)k--;
printf(" %ld",ar[0]);
for(j=1;j<=k;j++)
{
printf(" x %ld",ar[j]);
}
printf("\n");
}
}
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///.....................SESSION-(14-15)....................///
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<ctype.h>
#include<bits/stdc++.h>
using namespace std;
main()
{
long int a;
while(scanf("%ld",&a)!=EOF)
{
if(a==0)
break;
else if(a<0)
{
printf("%ld = -1 x",a);
a=a*-1;
}
else if(a>0)
{
printf("%ld =",a);
}
long k=0,i,j,ar[10000]={0};
for(i=2;i<=sqrt(a);i++)
{
while(a%i==0)
{
ar[k]=i;
k++;
a=a/i;
}
}
ar[k]=a;
if(ar[k]==1)k--;
printf(" %ld",ar[0]);
for(j=1;j<=k;j++)
{
printf(" x %ld",ar[j]);
}
printf("\n");
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন