eg. No? 24
output :
24 * 1
12 * 2
8*3
4*6
#include <iostream.h>
#include <conio.h>
void main()
{
int n, s = 1;
cout<<"\n Enter the number to calculate it's product component:";
cin>>n;
clrscr();
cout<<"\n The product Components of "<< n << " is\n";
for(int i = n; i> = s ; i--)
for(int j = 1; j<=n; j++)
{
if(i*j == n)
{
cout<< i << "*" << j << endl;
s = j+1;
}
}
getch();
}
No comments:
Post a Comment