Created
December 31, 2014 05:16
-
-
Save scratchyourbrain/6cc5d509901e708726f7 to your computer and use it in GitHub Desktop.
C program to Display Factors of a Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n,i; | |
printf("Enter a positive integer: "); | |
scanf("%d",&n); | |
printf("Factors of %d are: ", n); | |
for(i=1;i<=n;++i) | |
{ | |
if(n%i==0) | |
printf("%d ",i); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment