C语言问题,在线等回答:

[复制链接]
查看11 | 回复1 | 2010-11-3 19:36:48 | 显示全部楼层 |阅读模式
Questions: Given an integer number , write a program that displays the number as follows:
first line:
all digits
second line:
all except first digit
third line;
.....
last line:
the last digit
Example: the number is 7654
result will be as;
7654
765
76
7
#include
main()
{

int a,b,c,d,e;

printf("input a=");

scanf("%d",&a);

getchar();

printf("%d\n",a);



if(a>=10000)

b=a%10000;

c=a%1000;

d=a%100;

e=a%10;

printf("%d\n%d\n%d\n%d\n",b,c,d,e);

getchar();
if(1000int main(){ int x,temp,i,j,k; int top[100]; while(scanf("%d",&x)!=EOF) {i=0;while(1){ if(x==0) {
break; } top=x%10; x=x/10; i++;}for(k=0;k=k;j--)
{ printf(
回复

使用道具 举报

千问 | 2010-11-3 19:36:48 | 显示全部楼层
if(a>=10000)
b=a%10000;
c=a%1000;
d=a%100;
e=a%10;修改为
if(a>=10000){
b=a%10000;
c=a%1000;
d=a%100;
e=a%10;}其它的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行