wap to find the factors of a number.


#include<stdio.h>
void main()
{
    int a=2,num;
    printf("enter the number");
    scanf("%d",&num);
    printf("the factors of the number are\n%d",1);
    do
    {
        if(num%a==0)
        {
            num=(num/a);
        printf("\n%d",a);
        }
        else
            a++;
    }while(num!=1);

}

NOTE-  i have compiled this program in codeblocks if u do it in turbo c++  use  conio.h  header file in the beginning  and getch()  a the  last.

No comments:

Post a Comment

Implemet Stack in python

  class Stack : def __init__ ( self , data ): self . stack = [] if ( data ): self . stack . append ( da...