第一次作业

一、我爱学习c语言(P5)

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

二、分行输出自己的专业与姓名

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

三、用*号输出字母c的图案

 

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

 

 

  1. 编写程序,定义两个整型变量,赋值并输出(P18)

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

 

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

 

#include<stdio.h>
main() {
    float a = 1.2;
    double b = 2.3;
    printf("a=%f b=%f", a, b);
}

 

 

 


 

posted @ 2021-10-06 15:16  Lexington  阅读(38)  评论(0)    收藏  举报