Problem Statement
Write a c program to calculate factors of a number
you should take number as an input from user
#include<stdio.h>
int main()
{
int n,i,times;
printf("enter the value of the number\n");
scanf("%d",&n);
for(i=2;i<n+1;i++)
{
if(n%i==0)
{
times=0;
do
{
n= n/i;
times=times+1;
}
while(n%i==0);
printf("(%d^%d)*",i,times);
}
}
return 0;
}
Write a c program to calculate factors of a number
you should take number as an input from user
#include<stdio.h>
int main()
{
int n,i,times;
printf("enter the value of the number\n");
scanf("%d",&n);
for(i=2;i<n+1;i++)
{
if(n%i==0)
{
times=0;
do
{
n= n/i;
times=times+1;
}
while(n%i==0);
printf("(%d^%d)*",i,times);
}
}
return 0;
}
No comments:
Post a Comment