[ create a new paste ] login | about

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

C, pasted on Aug 31:
#include<stdio.h>
#include<conio.h>

int main()
{
	float x, S, T;
	int i, n;
	S = 0;
	T = 1;
	i = 1;
	
	printf("\nNhap x: ");
	scanf("%f", &x);
	
	x = -x;
	do
	{
	printf("\nNhap n: ");
	scanf("%d", &n);
	if(n < 1)
	{
		printf("\nDu lieu khong hop le. Xin kiem tra lai !");
	}
	}while(n < 1);

	while(i <= n)
	{
		T = T * x;
		S = S + T;
		i++;
	}
	printf("\nTong = %f", -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: