[ create a new paste ] login | about

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

C, pasted on Aug 21:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
	int i, n;
	float x, T, S;
	i = 1;
	T = 1;
	S = 0;
	do
	{
	printf("\nNhap x(x >= 0): ");
	scanf("%f", &x);
	  if(x < 0)
	  {
		  printf("\nx khong hop le. Xin nhap lai !");
	  }
	}while(x < 0);
	do
	{
	printf("\nNhap n(n >= 1): ");
	scanf("%d", &n);
	if(n < 1)
	  {
		  printf("\nn khong hop le. Xin nhap lai !");
	  }
	}while(n < 1);
	while(i <= n)
	{
		T = T * x;
		S = sqrt(T + S);
		i++;
	}
	printf("\nTong la %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: