第一次作业

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

#include<stdio.h>
int main()
{
    printf("我爱学习c语言!");
}

 

 

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

#include<stdio.h>
main()
{
    printf("计算机科学与技术\n");
    printf("周明俊\n");
}

 

 

3. 用*输出字母C的形状。

#include<stdio.h>
main()
{
    printf("Hello C-world!\n");
    printf("   ***\n");
    printf("  *\n");
    printf(" *\n");
    printf(" *\n");
    printf("  *\n");
    printf("   ***");
}

 

 

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

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

 

 

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

#include<stdio.h>
main()
{
    float m = 1.23;
    double n = 4.56;
    printf("%f%lf\n", m, n);
}

 

posted @ 2021-10-17 22:59  舟慕沉  阅读(27)  评论(0)    收藏  举报