[ create a new paste ] login | about

Link: http://codepad.org/Puw9r0jI    [ raw code | output | fork | 1 comment ]

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

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

	while(themang != 0)
	{
		P = P * (themang % 10);
		themang = themang / 10;
	}
	printf("\nTich la %d", P);

	getch();
	return 0;
}


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


Create a new paste based on this one


Comments:
posted by kawasakikute123@gmail.com on Oct 25
Cho em hỏi nếu nhập n = 0 thì ra tích = 1 là sao ạ?

reply