c程序设计实验报告
实验项目:
姓名:付余 实验地点:实验时间
一、实验目的及要求
1、掌握DEVC++的安装方法,并实现程序的编辑、编译、链接、运行。
2、通过运用简单的c语言程序,初步了解c语言的结构特点。
3、掌握c语言的基本类型及使用方法。
4、熟悉c语言运算符和表达式的正确使用方法。
5、熟练掌握markd的用法。
二、实验内容
#include<stdio.h>
main()
{
int a,b,c,d;
printf("enter a,b:");
scanf("%d,%d",&a,&b);
c=a+b;
d=a*b;
printf("c=%d\nd=%d\n",c,d);
}
![](https://img2020.cnblogs.com/blog/2318581/202103/2318581-20210329214844144-678826536.png)
#include<stdio.h>
main()
{
printf(" * \n");
printf(" *** \n");
printf(" ***** \n");
printf(" ******* \n");
printf(" ********* \n");
printf("***********\n");
}
![](https://img2020.cnblogs.com/blog/2318581/202103/2318581-20210329220507173-1553915265.png)
#include<stdio.h>
main()
{
printf("char:%d\n",sizeof(char));
printf("float:%d\n",sizeof(float));
printf("double:%d\n",sizeof(double));
}
![](https://img2020.cnblogs.com/blog/2318581/202103/2318581-20210329220908562-2137687310.png)
#include<stdio.h>
#include<math.h>
main()
{
float a,b,c;
printf("enter a,b\n");
scanf("%f %f",&a,&b);
c=(b+sqrt(b*b+2*a))/(a-b);
printf("c=%.2f",c);
}
![](https://img2020.cnblogs.com/blog/2318581/202103/2318581-20210329221501396-1523706020.png)
#include<stdio.h>
#define p 3.14
main()
{
float r,h,s,v;
printf("enter r,h");
scanf("%f %f",&r,&h);
s=r*r*p;
v=r*r*p*h/3;
printf("s=%.2f\nv=%.2f",s,v);
}
![](https://img2020.cnblogs.com/blog/2318581/202103/2318581-20210329221851000-1086590179.png)
流程图
![](https://img2020.cnblogs.com/blog/2318581/202103/2318581-20210329222856982-395622052.jpg)