[ create a new paste ] login | about

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

C++, pasted on Sep 24:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
	int i, n;
	float x, T, S;
	i = 1;
	T = 1;
	S = 0;
	printf("\nNhap x: ");
	scanf("%f", &x);

	printf("\nNhap n: ");
	scanf("%d", &n);

	while(i <= n)
	{
		//T = T * x * x;
		T = pow(x, (2 * i ));
		S = S + T;
		i++;
	}
	printf("\nTong la %f",S);

	getch();
	return 0;
}


Output:
1
2
3
4
Line 17: error: conio.h: No such file or directory
In function 'int main()':
Line 26: error: 'getch' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: