#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main()
{
int i,count = 0,input;
while (scanf("%d",&input) != EOF){
for (i = 2;i <= input;i++){
while (input % i == 0){
count++;
input /= i;
}
if (input > 1 && count == 1){
printf("%d *\n",i);
}
if (input == 1 && count > 1){
printf("%d^%d",i,count);
}
if (input == 1 && count == 1){
printf("%d",i);
}
if (input > 1 && count > 1){
printf("%d^%d *",i,count);
}
}
}
return 0;
}
#include
#include
#include
#include
int main()
{
int i,count = 0,input;
while (scanf("%d",&input) != EOF){
for (i = 2;i <= input;i++){
while (input % i == 0){
count++;
input /= i;
}
if (input > 1 && count == 1){
printf("%d *\n",i);
}
if (input == 1 && count > 1){
printf("%d^%d",i,count);
}
if (input == 1 && count == 1){
printf("%d",i);
}
if (input > 1 && count > 1){
printf("%d^%d *",i,count);
}
}
}
return 0;
}
已解決 感謝