URI Online Judge | 1157
Divisors I
Read an integer N and compute all its divisors.
Input
The input file contains an integer value.
Output
Write all positive divisors of N, one value per line.
Input Sample | Output Sample |
6 | 1 2 3 6 |
Solution:
#include <stdio.h> int main() { int n,i; scanf("%d",&n); for(i=1;i<=n;i++) { if(n%i==0) printf("%d\n",i); } return 0; } |
Post a Comment
0Comments