2006年9月全國等級考試三級c語言上機題庫(六十四)

2006年9月全國等級考試三級c語言上機題庫(六十四),第1張

2006年9月全國等級考試三級c語言上機題庫(六十四),第2張

★話題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


生活常識_百科知識_各類知識大全»2006年9月全國等級考試三級c語言上機題庫(六十四)

0條評論

    發表評論

    提供最優質的資源集郃

    立即查看了解詳情