#include<stdio.h>
int main()
{
	//tarife pointer
	int *i, *x, *m;
	//gereftane fazaye hafeze baraye pointer ha
	i = (int*)malloc(sizeof(int));
	x = (int*)malloc(sizeof(int));
	m = (int*)malloc(sizeof(int));

	//pardazesh barname
	*m = 0;
	printf ("yek adad vared konid : ");
	scanf("%d", x);
	for(*i = 0; *x > 0; (*i)++)
	{
		*m += (*x) % 10;
		(*x) /= 10;
	}
	printf("Jame Argham = %d\n", *m);

	//azad sazi fazaye hafeze baraye pointer ha
	free(i);
	free(x);
	free(m);

	getch();
}

