博客
关于我
磕代码:c/c++/java:输入年龄,输出活了多少秒
阅读量:86 次
发布时间:2019-02-26

本文共 730 字,大约阅读时间需要 2 分钟。

在这里插入图片描述

在这里插入图片描述
c:

#include
int main(){ long int age; /*scanf("%d",&age);*/ scanf("%ld",&age); long int b=31560000; /*printf("%d",age*b);*/ printf("%ld",age*b); /*%ld 的话2113 输出的字节要长点 %d 的要短点5261。比如,一个数大于32767 用%d 就要溢出4102。假1653如你想输出32768.用%d 就会输出-1.这就是溢出。但是用%ld 就不会。它能接受的数的范围大些!希望你懂了! 输出-32768~32767以内的数都一样!*/}

c++:

#include
using namespace std;int main(){ long long age; cin>>age; cout<

Java:

import java.io.*;public class Main{       public static void main(String[]args)throws IOException{           BufferedReader br=new BufferedReader (new InputStreamReader(System.in));        String age=br.readLine();        long a=Integer.parseInt(age);        System.out.println(a*31560000);    }}

转载地址:http://fyrk.baihongyu.com/

你可能感兴趣的文章
MySQL常用日期格式转换函数、字符串函数、聚合函数详
查看>>
MySQL常见函数
查看>>
MySQL常见架构的应用
查看>>
MySQL常见的三种存储引擎(InnoDB、MyISAM、MEMORY)
查看>>
MySQL常见的三种存储引擎(InnoDB、MyISAM、MEMORY)
查看>>
MySQL常见约束条件
查看>>
MySQL常见错误
查看>>
MySQL常见错误分析与解决方法总结
查看>>
mysql并发死锁案例
查看>>
MySQL幻读:大家好,我是幻读,我今天又被解决了
查看>>
MySQL底层概述—1.InnoDB内存结构
查看>>
MySQL底层概述—2.InnoDB磁盘结构
查看>>
MySQL底层概述—3.InnoDB线程模型
查看>>
MySQL底层概述—4.InnoDB数据文件
查看>>
MySQL底层概述—5.InnoDB参数优化
查看>>
MySQL底层概述—6.索引原理
查看>>
MySQL底层概述—7.优化原则及慢查询
查看>>
MySQL底层概述—8.JOIN排序索引优化
查看>>
MySQL底层概述—9.ACID与事务
查看>>
Mysql建立中英文全文索引(mysql5.7以上)
查看>>