[ create a new paste ] login | about

Link: http://codepad.org/PRY5vd6c    [ raw code | output | fork ]

C, pasted on Aug 21:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
	int themang, n;
	int S;

	do
	{
	printf("\nNhap n: ");
	scanf("%d", &n);
	}while(n < 0 && printf("\nLoi: n >= 0 !"));
	S = 0;
	themang = n;

	while(themang != 0)
	{
		S = S + themang % 10;
		themang = themang / 10;
	}
	printf("\nTong la %d", S);

	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments: