----------------解决方案--------------------------------------------------------
main()
{
int n,c;
printf("Enter n=");
scanf("%d",&n);
do
{
printf("%d+",n%10);
n=n/10;
}
while(n>1);
printf("c=%d",n);
getch();
}
可以把你所输入的整数分解为他的各个数的和,如123:1+2+3
----------------解决方案--------------------------------------------------------
有点改动了,呵呵,谢谢大家帮忙了!
----------------解决方案--------------------------------------------------------
#include<stdio.h>
int main(void)
{
long int n,c=0;
printf("Enter n=");
scanf("%d",&n);
do
{c=c*10+n%10;n/=10;}
while(n>0);
n=c;
do{
(c==n)?printf("%d",c%10):printf("+%d",c%10);
c/=10;
}while(c>0);
return 0;
}
----------------解决方案--------------------------------------------------------
在WIN-TC下运行就这个
#include<stdio.h>
#include<conio.h>
int main(void)
{
long int n,c=0;
printf("Enter n=");
scanf("%ld",&n);
do
{c=c*10+n%10;n/=10;}
while(n>0);
n=c;
do{
(c==n)?printf("%ld",c%10):printf("+%ld",c%10);
c/=10;
}while(c>0);
getch();
return 0;
}
----------------解决方案--------------------------------------------------------
[讨论][求助 解决了
#include<stdio.h>
int main(void)
{
long int n,c=0;
printf("Enter n=");
scanf("%ld",&n);
do
{c=c*10+n%10;n/=10;}
while(n>0);
n=c;
do{
(c==n)?printf("%ld",c%10):printf("+%d",c%10);
c/=10;
}while(c>0);
return 0;
}
----------------解决方案--------------------------------------------------------