Friday, August 17, 2018

POSITIVE INTEGER

        Problem Description

Program to find a Factors of a Positive Integer

CODING ARENA::

#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;
}
    Test Case 1

Input (stdin)
75



Expected Output
1 3 5 15 25 75
Test Case 2

Input (stdin)
16



Expected Output
1 2 4 8 16


No comments:

Post a Comment