博客
关于我
磕代码: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中UPDATE语句的神奇技巧,让你操作数据库如虎添翼!
查看>>
Mysql中varchar类型数字排序不对踩坑记录
查看>>
MySQL中一条SQL语句到底是如何执行的呢?
查看>>
MySQL中你必须知道的10件事,1.5万字!
查看>>
MySQL中使用IN()查询到底走不走索引?
查看>>
Mysql中使用存储过程插入decimal和时间数据递增的模拟数据
查看>>
MySql中关于geometry类型的数据_空的时候如何插入处理_需用null_空字符串插入会报错_Cannot get geometry object from dat---MySql工作笔记003
查看>>
mysql中出现Incorrect DECIMAL value: '0' for column '' at row -1错误解决方案
查看>>
mysql中出现Unit mysql.service could not be found 的解决方法
查看>>
mysql中出现update-alternatives: 错误: 候选项路径 /etc/mysql/mysql.cnf 不存在 dpkg: 处理软件包 mysql-server-8.0的解决方法(全)
查看>>
Mysql中各类锁的机制图文详细解析(全)
查看>>