第一次上机作业

1.编写程序,输出“我爱学习C语言!”

#include<stdio.h>
main()
{
    printf("我爱C语言!\n");
}

 

 

2.分行输出自己的专业和姓名

#include<stdio.h>
main()
{
    printf("信息与控制工程系\n计算机科学技术\n李金燕");
}

 

3.用*号输出字母C的图案。

 

 

#include<stdio.h>
main()
{
    printf("  ***\n **\n*\n*\n **\n  ***\n");
}

4.编写程序,定义两个整形变量,赋值并输出

#include<stdio.h>
main()
{
    int a=8;
    int b=4;
    printf("%d\n",a);
    printf("%d\n",b);
}

 

 

5.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。

 

 
#include<stdio.h>
main()
{
    float x=2.33;
    double y=3.44;
    printf("%f%lf\n",x,y);
}

 

 

 

 

 
posted @ 2021-11-30 10:30  一颗月亮  阅读(18)  评论(0)    收藏  举报