Count the digits of any input integers
来源:互联网 发布:arclive有没有mac 编辑:程序博客网 时间:2024/05/17 04:53
Given an interger,
1) Count its digits
2) Output its every digit seperately
3) Output this integer in reverse order
Hint: Use character string to store the input interger
#include<stdio.h>int main(){ char str[100]; int i, count = 0; printf("Please input an integer:\n"); scanf("%s",str); for (i = 0; str[i]!='\0'; i++) { count++; printf("%c\n",str[i]); } for (i = count; i >= 0; i--) { printf("%c",str[i]); } printf("\nThe digits of this integer is %d\n",count); return 0;}
Input:
Please input an interger:
5543654
Output:
5
5
4
3
6
5
4
4563455
The digits of this integer is 7
0 0
- Count the digits of any input integers
- [zz]Determine the maximum of two integers using macro without any operators.
- Problem Description Your task is to calculate the sum of some integers. Input Input contains an
- Count the number of alphabets, spaces, digits and other characters in one line character
- HNU 13365 Circle of digits Input hou
- leetcode 258. Add Digits /371. Sum of Two Integers
- Digits Count
- sorted array consisted of squares of input integers
- Can be any number of the Calculator
- ural 1014 the product of digits
- THE MNIST DATABASE of handwritten digits
- The Count of Monte Cristo
- URAL 1206 Sum of Digits of the Sum of Numbers
- One of the Text Input
- The first experience of any type of regression
- fzu 2105 Digits Count
- FZU 2105 Digits Count
- FZU2105 Digits Count
- 【水讨论】#53 A. Square Earth?
- C语言之一维数组
- UVALive 5025 Arranging Your Team
- Struts2 --如果想看源码 Struts源码
- UVA11205
- Count the digits of any input integers
- C语言之认识C
- 一些表达式的陷阱
- 设置tabhost位于底部的三种方法
- 插入排序_2.折半插入排序
- 【笔试面试——26】链表06——复杂链表的复制
- 黑马程序员学习6
- 在ajax提交数据时不能乱用php代码
- hadoop2.4.1的ftp服务器搭建