1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

Getting prime factors

Discussion in 'Coding, Programming' started by ken21, Feb 19, 2016.

  1. #include<stdio.h>
    #include<conio.h>
    #include<math.h>
    main()
    {
    int i,num;

    printf("Enter number:");
    scanf("%d",&num);

    printf("\nAll prime factors of %d are: ",num);

    i=2;

    while(num!=0){
    if(num%i!=0)
    i=i+1;
    else{
    num=num/i;
    printf("\t%d",i);
    if(num==1)
    break;
    }
    }
    getch();
    }
     
  2. ryruz

    ryruz Enthusiast Established

  3. both, try mo lang
     
  4. jjarongay

    jjarongay Forum Veteran Established

    Thanks for sharing ts (y)
    Wala ako IDE ng C++ ehhh!
     
Tags / Keywords: