#include<stdio.h>
#include<string.h>
int main()
{
char a[200];
int i,n,b=0, j = 0;
scanf("%s", a);
n = strlen(a);
for(i=0;i<n;i++)
{
if(a[i]>=48 && a[i]<=57)
{
b = b +(a[i] - 48);
printf("%d", a[i] - 48);
}
if(a[i+1]>=48 && a[i+1]<=57)
{
if(j>0)
{
printf(" + ");
}
else
j++;
}
}
printf(" = %d\n", b);
return 0;
}
#include<string.h>
int main()
{
char a[200];
int i,n,b=0, j = 0;
scanf("%s", a);
n = strlen(a);
for(i=0;i<n;i++)
{
if(a[i]>=48 && a[i]<=57)
{
b = b +(a[i] - 48);
printf("%d", a[i] - 48);
}
if(a[i+1]>=48 && a[i+1]<=57)
{
if(j>0)
{
printf(" + ");
}
else
j++;
}
}
printf(" = %d\n", b);
return 0;
}
Comments
Post a Comment