C++ 程序:求一个数的除数
原文:https://www.studytonight.com/cpp-programs/program-to-find-divisor-of-a-number-in-cpp
下面是求给定数除数的程序。
#include<iostream.h>
#include<conio.h>
int main()
{
int i, n1;
clrscr() ;
cout<<"Enter the number to find it's divisors : " ;
cin>>n1 ;
cout<<"\nThe divisors are :\n") ;
for(i = 1 ; i <= n1 ; i++)
if(n1 % i == 0)
cout<<"\t"<<i ;
getch() ;
return 0;
}
输入数字找到它的除数:21 除数是: 1 3 7 21