Răspuns :
#include <stdio.h>
#include <stdlib.h>
int n, s;
int main()
{
scanf("%d", &n);
s = 0;
while(n != 0)
{
s = s + n % 10;
n = n / 10;
}
printf("%d",s);
return 0;
}
#include <stdlib.h>
int n, s;
int main()
{
scanf("%d", &n);
s = 0;
while(n != 0)
{
s = s + n % 10;
n = n / 10;
}
printf("%d",s);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,s=0;
scanf("%d", n);
do{
s+=n%10;
n/=10;
}while(n);
printf("%d\n", n);
}
#include <stdlib.h>
int main()
{
int n,s=0;
scanf("%d", n);
do{
s+=n%10;
n/=10;
}while(n);
printf("%d\n", n);
}