Problem Description
Program to find a Factors of a Positive IntegerTest Case 1
Input (stdin)75
Expected Output1 3 5 15 25 75
Test Case 2
Input (stdin)16
Expected Output1 2 4 8 16
Program
#include <stdio.h> int main() { int num,i; scanf("%d",&num); for(i=1;i<=num;i++) { if(num%i==0) printf("%d ",i); } return 0; }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.