该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
小弟马上c语言考试 老师勾的题大部分都不会 望万能的窝吧能帮帮我 求大神啊~~~
1. Write a program to compute the value of Euler’s number e, which is used as the base of natural logarithms. Use the following formula.
e = 1+ 1/1! + 1/ 2! + 1/3! +…… + 1/n!
Use a suitable loop construct. The loop must terminate when the difference between two successive values of e is less than 0.00001.
2. Write program to print the following outputs using for loops.
*****
****
***
**
*
3. Write program to print the following outputs using for loops.
*
**
***
****
*****
4. Write program to print the following outputs using for loops.
*
***
*****
*******
*********
5. The numbers in the sequence 1 1 2 3 5 8 13 21 ……. are called Fibonacci numbers.
Write a program using a do…while loop to calculate and print the first m Fibonacci numbers.
6. Given a number, write a program using while loop to reverse the digits of the numbers.
For example, the number 12345 should be written as 54321
(Hint: Use modulus operator to extract the last digit and the integer division by 10 to get the n-1 digit number from the n digit number.)
7. Write a program to evaluate the equation y = xn , When n is a non-negative integer.
8. Write a program to print all the daffodil numbers. Daffodil numbers are those numbers, which are 3-digit numbers, sum of cubic of each digit equals to the number, for example, 153=13+53+33
9. Input a positive number from keyboard, and then judge whether the input number is a prime, if it is a prime, then print “yes”, else print “no”.
10. Input a number n from keyboard, then calculate 1!+2!+…+n!.
11. Input a number n from keyboard, then calculate 1+(1+2)+(1+2+3)+…+(1+2+3+…+n).
12. Input a year n from keyboard, and then judge whether the year is a leap year.
Leap year is a year which satisfies only one of the following conditions:
(1) It is divisible by 4, but not divisible by 100
(2) It is divisible by 400.
13. Write a program according to the following function, which requires input x from keyboard, then output the corresponding y.
14. Input an arithmetic expression from keyboard, and then output its result. Format of the arithmetic expression is as follows, a op b, in which a and b are integers, op is operand, such as +、-、*、/、%.
15. We all knew that the months 1, 3, 5, 7, 8, 10, 12 in 1998 has 31 days, months 4, 6, 9, 11 has 30 days, month 2 has 28 days. Write a program to give days of the month, which requires input month from keyboard.
16. Input a positive number from keyboard, and then judge whether the input number is divisible by 3 and divisible by 5, and then print “yes” or “no” respectively.