Computer Science, asked by shubhverma9, 11 months ago

wap to input a number and print all odd factors​

Answers

Answered by gurukulamdivya
2

Here is your Answer:

#include <stdio.h>

int main()

{

   int i, num;

   /* Input number from user */

   printf("Enter any number to find its factor: ");

   scanf("%d", &num);

   printf("All factors of %d are: \n", num);

  for(i=1; i<=num; i++)

   {

             if(num % i == 0)

       {

         if (i%2==1)

         printf("%d, ",i);

       }

   }

   return 0;

}

Similar questions