码迷,mamicode.com
首页 > 编程语言 > 详细

C语言代码第二天

时间:2020-09-17 20:00:07      阅读:39      评论:0      收藏:0      [点我收藏+]

标签:code   代码   ima   fir   http   mat   har   png   cat   

数据类型

技术图片

 

 

 代码:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {
    int i = 4;
    double d = 4.0;
    char s[] = "HackerRank ";

    
    // Declare second integer, double, and String variables.声明第二个int  ,double ,字符数组
    int i1;
    double d1;
    char s1[200];
    // Read and save an integer, double, and String to your variables.读取并保存上面输入的值
    scanf("%d",&i1);
    scanf("%lf",&d1);
    scanf("%*[\n]%[^\n]",s1);                 //这里看上一篇预习的解析。
    // Print the sum of both integer variables on a new line.打印两个整数的和
    printf("%d\n",i+i1);

    // Print the sum of the double variables on a new line.打印两个浮点数的和,并控制输出位数
    printf("%.1lf\n",d+d1);
    // Concatenate and print the String variables on a new line.连接两个字符串(考虑拼接函数)
    printf("%s%s\n",s,s1);
    // The ‘s‘ variable above should be printed first.

    return 0;

C语言代码第二天

标签:code   代码   ima   fir   http   mat   har   png   cat   

原文地址:https://www.cnblogs.com/chen-le23/p/13640559.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!