杭电acm--2051
2015-09-20 18:04
309 查看
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
[align=left]Input[/align]
For each case there is a postive number n on base ten, end of file.
[align=left]Output[/align]
For each case output a number on base two.
[align=left]Input[/align]
For each case there is a postive number n on base ten, end of file.
[align=left]Output[/align]
For each case output a number on base two.
#include<stdio.h> #include<stdlib.h> //#include<string.h> //#include<math.h> void main() { int n, arr[500], t = 0; while (scanf("%d", &n) != EOF) { for (int i = 0; n!=0; i++) { arr[i] = n % 2; n = n / 2; t = i; } for (int i = t; i >= 0; i--) printf("%d", arr[i]); printf("\n"); } system("pause"); }
相关文章推荐
- javascript中对象的属性的特性
- 基于MapReduce的连接查询算法
- POJ2195 Going Home 【最小费用流】+【最佳匹配图二部】
- 认清自我,创造未来!!!
- Android PopupWindow使用之地区、学校选择二级联动
- 数据库(增、删、改、查)
- 数据库(增、删、改、查)
- prepare 预编译SQL:Mysql
- 单链表反转/逆序的两种方法
- 业界编译器Clang介绍
- Ubuntu 14.04下NFS安装配置
- 原来指针可以这么来理解,妈妈再也不用担心我的编程了
- 黑马程序员——多线程
- testlink和mantis集成
- es6 标准 Promise 学习笔记
- 理解javascript闭包和C++闭包
- 【ecmall】解决无法上传店铺logo和banner照片问题(二)
- RQNOJ 题目273 马棚问题(DP)
- hdu 1302 The Snail
- HTML+CSS页面滚动效果处理