这是本人搜录的,绝对有用。
C语言实验报告
实验1-1:
hello world程序:
源代码:
#include<stdio.h>
main()
{
printf("hello world!\n");
system("pause");
}
实验1-2:
完成3个数据的输入、求和并输出计算结果的程序:
源代码:
#include<stdio.h>
main()
{
int i,j,k,sum;
scanf("%d%d%d",&i,&j,&k);
sum=i+j+k;
printf("sum=%d",sum);
system("pause");
实验1-3:
在屏幕上输出如下图形:
A
BBB
CCCCC
源代码:
#include<stdio.h>
main()
{
printf(" A\n");
printf(" BBB\n");
printf(" CCCCC\n");
system("pause");
}
实验2-1:
计算由键盘输入的任何两个双精度数据的平均值
源代码:
#include<stdio.h>