易截截图软件、单文件、免安装、纯绿色、仅160KB

求序列和的简单C程序

对于序列求和的程序大家不会陌生,而我今天看到的这个程序个人觉得比较好,所以贴上来共享一下。
要求:输入类似于87 98 67 56 0的任意序列,但是以零结尾。然后输出序列的和。
程序如下 :
/********************************************
 * Name : sum.c
 * Purpose : sum
 * Author : zimo
 * Date : 01/21/2010
 * *****************************************/
#include <stdio.h>
int main(void)
{
    int n , sum = 0;
    printf("This program sums a series of integers. \n");
    printf("Enter integers (0 to terminate): ");
    scanf("%d", &n);
    while(n != 0)
    {
        sum += n;
        scanf("%d", &n);
    }
    printf("The sum is: %d \n", sum);
    return 0;
}
两次的输入语句个人觉得非常好。(所输入的序列要求必须是最后一个数为零,当然也可以简单的修改)


相关文档:

[转]C/C++资源大汇总(很好很强大)

1.开发工具下载
TUBER C                     http://www.duote.com/soft/392.html
Turbo C 2.0 汉化版             http://www.programfan.com/showdown.asp?id=306
C-Free 4.0             http:/ ......

C打印 大数的 阶乘

 6000甚至10000,都可以,但大于6000,就开始滚屏了。。
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int i,j,*f,tmp,c=0;
long int n,bits;
const double PI=2*asin(1.0),E=exp(1.0);
scanf("%ld",&n);
bits=(long)ceil(n*(log10(n)-log ......

用php的c扩展编程调用 c程序的动态链接库


一.    首先做一个简单的so文件:
    /**
     * hello.c
     * To compile, use following commands:
     *   gcc -O -c -fPIC -o hello.o hello.c
     *   gcc -shared ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号