Factors between 1 to 100 for a given number - C-Tutorial

Latest

Sunday, 8 December 2019

Factors between 1 to 100 for a given number


/* Factors between 1 to 100 for given number */

#include<stdio.h>
#include<conio.h>

void main()
{
int n, i;
clrscr();
printf("\n Enter a number: ");
scanf("%d",&n);
printf("\n The factors of %d is: \n", n);
for(i=1;i<=100;i++)
{
if(n%i==0)
printf("\t %d", i);
}
getch();
}

No comments:

Post a Comment