c语言课件第2章旗c语言概述.pptVIP

  • 0
  • 0
  • 约小于1千字
  • 约 19页
  • 2021-04-01 发布于福建
  • 举报
2.1 C语言的特点;2.2 C源程序结构;;;例2.3 求 1+2+3+4+……+n. (其中n由用户输入)。 main() { int n,s; printf(“ enter n:”); scanf(“%d”,n); /*输入整数n*/ s=sum(n); /*函数调用*/ printf(“\n the result is :%d”, s ); /*输出结果*/ } int sum( int m) /*函数定义*/ { int j, s1=0; for(j=1;j=m;j++) /*求和*/ s1+=j; return(s1); } /*返回和值*/;C源程序的一般结构小结:;关于C源程序结构的说明;;3 .函数的一般结构;;5.源程序的书写格式 ①书写(或输入)源程序

文档评论(0)

1亿VIP精品文档

相关文档