2006年9月全國等級考試三級c語言上機題庫(六十四)
★話題64(無憂id 22質數題)
下麪這個程序的作用是找出100以內(含100)的所有整數I (I 10也在100以內)的個數cnt以及這些I的和。請編寫函數countValue()實現程序要求的函數,最後調用函數writeDat()將結果cnt和sum輸出到文件out.dat
部分源程序存在於prog1.c文件中
請不要更改主函數()和輸出數據函數writeDat()的內容。
#包括
int cnt,sum
int isPrime(整數)
{
int i,tag = 1;
for(I = 2;tag & & IIF(number % I = = 0)tag = 0;
返廻標簽;
}
void countValue()
{ int I;
for(i=2;i
0條評論