Advertisement
AedenCak3

C program to print all the odd factors of a given number

Nov 15th, 2021
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.23 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,n, sum=0;
  5.  
  6.     printf("enter a number: ");
  7.     scanf("%d", &n);
  8.  
  9.     for (i=1; i <= n ; i+=2)
  10.         {
  11.         if( n%i == 0)
  12.             printf("%d\n",i);
  13.         }
  14.  
  15.  
  16.   return 0;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement