c语言extract(20 4),几道c语言题目 求c语言大神啊

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

小弟马上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.

0d7d44d5f35fe00eadef05dfe8d5112f.png

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值