DEV/DEV1.1/TP06/facteur.c

27 lines
393 B
C
Raw Normal View History

2022-10-12 16:41:20 +02:00
#include <stdio.h>
#include <stdlib.h>
int main(void){
int x = 0;
int i;
int j;
printf("Rentrer un entier: ");
scanf("%d",&x);
printf("%d = ",x);
while(x!=0){
for(j = 2;j<x;j++) {
for(i = 1;i<j;i++)
if (i==1){printf("");}
else{
if ((j%i)==0) {
i=2*j;
}
}
}
if(i!=(2*j)&&(x%j==0)){
x=x/j;
printf("%d*",j);
}
}
return EXIT_SUCCESS;
}