Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  factor
Language: C/C++
Code:
#include <stdio.h> 
#include <stdlib.h>
int main (void)

long num=0; 
long d=2;
printf("Enter a number to factor: "); 
scanf("%ld", &num);

while(num != 0) 

if(num%d==0) 
{ num = num / d; 
if(num==1) break;} 
else{ d = d+1; } }

printf("The largest prime factor is: %ld\n", d);
system("pause");
return 0; }
          
          
          
          
          
          
          
          
          
          
Comments: