《c语言程序设计》复习题库(C programming language review questions library).doc
文本预览下载声明
《c语言程序设计》复习题库(C programming language review questions library)
C programming language review questions library
1. Calculate the value of the following formula. T=1/1! +1/2! +1/3! +...... +1/m! When m=5 results (press four to five, keep 3 decimal places). (Note: all variables are defined by the float data type!) Answer: 1.717
2. Fill in the blanks: use * to output the letter C.
#include stdio.h
#include conio.h
(main)
{
_____________
Printf? (*\n);
_____________?
_____________
Getch?;
}
3, 8232, and 9678, and their numbers, ten, 100, 000, are multiples of 15, 8+2+3+2=15,9+6+7+8=30. Write programs to find all the odd numbers of four digits, the sum of the numbers (the sum of the numbers is 15 multiples). Note: all variables are defined with the long data type! Answer: 1533459
4, / * function following procedure is: to calculate and output less than 700 of the 10 largest natural number can be divisible by 13 or 17 and. Please correct the errors in the program and run, and finally give the correct results of the program running. (Note: there is only one mistake!) Answer: 6591.
#include stdio.h
Void, main ()
{
Int, total=0, mc=1, k=700;
Int, pm[10], count=0;
While ((k=2) mc=10)
{
If ((k%13==0) || (k%17==0))
{
Pm[mc] = k;
Mc++;
}
K--;
}
For (k=1; k=10; k++)
Total = pm[k-1];
Printf (%d\n, total);
}
5, seek x = 1+1/5+1/7+1/9+... The approximate value of the last item is less than 10-5.
6. Calculate the A20 value of the following formula. A1=1, A2=1/ (1+A1), A3=1/ (1+A2), A4=1/ (1+A3),... (four, five, 10 decimal places). Answer: 0.6180339850
7, seek the sum of odd numbers that [101600] can be divisible by 7. Answer: 90965
8, function mystrlen (char *s) function is to find the string s length. Fill in the blanks, please.
Int mystrlen (char *s)
{int num=0;
{____ (while);}
Return ();
}
The sum between 9 and [100500] satisfies the sum divided by 7 over 5 divided by 5 more than 3 by 3 1. Answer: 1042
10, seek the number of all prime numbers between [100999]. Answer: 143
11, wri
显示全部